Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Git 101

185 views

Published on

Introduction in Git for beginners. The presentation explains how to install git and how to work with local repositories.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Git 101

  1. 1. GIT 101
  2. 2. Who invented Git? QUIZ!
  3. 3. Linus Torvalds ANSWER
  4. 4. Why is it called Git? "the stupid content tracker” Linus Torvalds has quipped about the name "git", which is British English slang for a stupid or unpleasant person: "I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git." (Note that Torvalds did not in fact name Linux.)
  5. 5. Central vs Distributed VCS CENTRAL VCS DISTRIBUTED VCS Each can act as a serverthe dev team only interacts with the main server
  6. 6. Distributed VCS Benefits You can start a repository at any time on your local computer Commit history is stored locally Redundancy - each working copy effectively functions as a remote backup
  7. 7. How Git stores data? • most other systems store information as a list of file-based changes • Git thinks of its data more like a set of snapshots of a miniature filesystem • Every time you commit, or save the state of your project in Git • Git thinks about its data more like a stream of snapshots. • Git tracks files not folders
  8. 8. The Three States states of files committed stored in local repo modified changed but not committed staged marked to go into next commit
  9. 9. Three sections of Git project
  10. 10. Hands-on exercise 1. Install Git on Windows ◦ http://git-scm.com ◦ Download and run installer 2. Install Git on Mac ◦ Type in terminal: git version 3. Configure Git ◦ git config –-global user.name “Your Name” ◦ git config --global user.email “your.email@sephora.com” 4. Create local repository ◦ git init
  11. 11. The Basics → Open terminal → Create a location for the lab mkdir projects cd projects → Create a repository git init git-101 ls –al cd git-101 cd .git
  12. 12. Commit git status  Create a file README.md touch README.md git add README.md git commit –m “My first commit” git log git show  Modify README.md git status git commit –am “My second commit” git log
  13. 13. Backing out changes  Modify README.md git status git add .  How to unstage changes? git reset HEAD README.md git status  How to revert changes entirely? git checkout -- README.md
  14. 14. Rename and remove a file Create a file example.txt git status git add example.txt git commit -m "adding example file" git mv example.txt demo.txt ls git status git commit -m "renaming example” git rm demo.txt git commit -m ”removing demo”
  15. 15. GIT States with Remote
  16. 16. How to change Git state
  17. 17. Summary git init <repo-name> git status git add <file1-name> <file2-name> git commit -m "<Messgae>” git show git log git mv <fil1> <file2> git rm <file1>
  18. 18. Next Week Work with remotes Create Branches Create Pull Request

×