Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Git and GitHub

Introduction to Git and GitHub

These are the same slides used by me into the webinar on April 20, 2020, at 4:00 pm and I published these slides as participants asked me for that.

All basics and simple commands of git are explained into these slides.

Nand Kishor

April 20, 2020
Tweet

Other Decks in Technology

Transcript

  1. Let’s Git this Party Started Nand Kishor DSC CGC Lead

    @nandkk05 An Introduction to Git and GitHub
  2. before we start... • Turn off your camera and microphone

    • Keep a cool head • Keep your laptop near yourself to have hands-on experience (in case you want to)
  3. What is ? Git is a distributed version-control system which

    keeps track of changes to your code. or Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
  4. Distributed Version Control Systems Synchronise the code between different people.

    If any server dies, and these systems were collaborating via that server, any of the client repositories can be copied back up to the server to restore it. You can test code without losing the original code. Revert back to old versions of code. Every clone is really a full backup of all the data.
  5. What is git? Keeps track of changes to your code.

    Synchronise the code between different people. Test changes to your code without losing the original. Revert back to the old versions of code.
  6. What is GitHub? Git”Hub” is a code hosting platform for

    collaboration and version control. It allows us to use git and create repositories online. It can also store all your projects online for free.
  7. How to use git? If you’re using git into your

    project then it will have a folder .git which stores all the history of your project. You can use git with command line interface (it can be windows command prompt or terminal) or by GitHub Desktop (download GitHub desktop from desktop.github.com)
  8. Download and install git Now to start with some practical

    examples we have to download and install git on our local machine by visiting the website - git.scm.com/downloads You can download git for Mac OS, Windows and Linux/Unix.
  9. git init To initialise the git into your repository. It

    creates .git folder into your working repository.
  10. git clone <url> Makes a copy of the repo. Stores

    it to your local machine (computer) “Fork” creates your own copy of someone else’s repo
  11. git add <filename> Adds a file to the “staging area”

    Tells git to add this file in the next revision of the repository git add . command adds all the changed files to the staging area.
  12. git commit -m “message” Saves the changes to the repo

    as a new revision. Records a message. git commit -am “message” adds and commit in the same step.
  13. • modified • staged • committed Git has three main

    states that your files can reside in:
  14. git push Send commited changes to the remote repository. If

    you’re using new repo, then use git push origin master.
  15. Merge conflicts When two different commits can’t be merged automatically.

    This is need to be resolved manually. When you “pull” new changes from the remote.
  16. git log Shows a history of commits and messages. Shows

    who made the change, when that change has been made with a “message” Try to make good commit “messages”
  17. git reset git reset --hard <commit> Revert code to previous

    commit. git reset --hard origin/master Reverts code back to remote repository version.
  18. git branch Shows all the branches of the code. Creates

    a branch with git branch <branch_name> Switch to checkout a new branch using git checkout <branch_name>
  19. GitHub Classroom - classroom.github.com GitHub Campus Advisor - education.github.com/teachers/advisors GitHub

    Campus Expert - education.github.com/students/experts GitHub Student Developer Pack - education.github.com/pack Important Links
  20. Hacktoberfest by GitHub Hacktoberfest is a month-long celebration of open

    source software. Each October, open source maintainers give new contributors extra attention as they guide developers through their first pull requests on GitHub.