Getting Started on distributed version control with git

1,264 views

Published on

Learn how to use git and get accustomed with 15+ most common git commands.

Published in: Engineering, Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,264
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
37
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Getting Started on distributed version control with git

  1. 1. ANOOP THOMAS MATHEW CTO @ Profoundis Inc. Getting Started with git
  2. 2. A Little Story April 2005 Linux Kernel BitKeeper issue Linus Torvalds 36% professional developers @atmb4u
  3. 3. Need for Distributed Version Control Meet Smarty! He works as a Software Developer. @atmb4u
  4. 4. Need for Distributed Version Control ● His job – Create – Save – Edit – Repeat. ● Smarty's friends want to collaborate? @atmb4u
  5. 5. Need for Distributed Version Control @atmb4u
  6. 6. git Basics ● Distributed ● Collaborative History Tracking ● Merge ● Flexible ● Fast @atmb4u
  7. 7. git workflow @atmb4u
  8. 8. git workflow @atmb4u 1. You MODIFYfiles in your working directory. 2. You STAGEthe files, adding snapshots of them to your staging area. 3. You do a COMMIT, which takes the files as they are in the staging area and stores that snapshot permanently to your git directory.
  9. 9. git Basics @atmb4u
  10. 10. @atmb4u@atmb4u git commands
  11. 11. ● git config --global user.name "UserName" ● git config --global user.email “email@example.com” git config @atmb4u@atmb4u
  12. 12. initialize a git repository on current folder git init @atmb4u
  13. 13. Retrives the status of the git repository git status @atmb4u
  14. 14. ● Adds the file to the version control ● git add <filename> git add @atmb4u
  15. 15. ● Commit the added changes to the repo ● git commit -m “commit message” git commit @atmb4u
  16. 16. ● Add a remote server location for the repo ● git remote add origin <remote url> ● git remote rm origin git remote @atmb4u
  17. 17. ● Push changes to the destination ● git push origin master remote branch git push @atmb4u
  18. 18. ● Shows the history of commits of the current branch git log @atmb4u
  19. 19. ● Shows the difference between two commits in git ● git diff 23f4af3 09fb5f2 ● Writing this to a file gives you a patch git diff @atmb4u
  20. 20. ● Include all changes specified in a patch file ● git apply <patch file> git apply @atmb4u
  21. 21. ● download new branches and data from a remote repository git fetch @atmb4u
  22. 22. ● fetch from a remote repo and try to merge into the current branch ● git pull <remote location> <branch> git pull @atmb4u
  23. 23. ● list, create and manage working contexts ● git branch ● git branch <branch name> (create new branch) git branch @atmb4u
  24. 24. ● switch to a new branch context ● git checkout <branch name> ● git checkout -b <branch name> (create branch and checkout) git checkout @atmb4u
  25. 25. ● merge a branch context into your current one ● git merge git merge @atmb4u
  26. 26. Merge conflicts ! @atmb4u
  27. 27. ● tag a point in history as important ● git tag -a v1.0 git tag @atmb4u
  28. 28. ● remove files from the staging area ● git rm <file name> ● git rm –cached <file name> git rm @atmb4u
  29. 29. ● save changes in the current index and working directory for later ● git stash ● git stash apply ● git stash list ● git stash drop git stash @atmb4u
  30. 30. ● save changes in the current index and working directory for later ● git reset HEAD <file name> ● git reset --soft ● git reset HEAD --hard git reset @atmb4u
  31. 31. ● copy a git repository so you can add to it ● git clone <remote repo url> git clone @atmb4u
  32. 32. ● github ● Learn a language of choice ● Commit once a day Live Projects @atmb4u
  33. 33. Code Explorer's Guide to the Open Source Jungle https://leanpub.com/opensourcebook/ My new Book @atmb4u FREE
  34. 34. ● @atmb4u ● We are looking for interns. Thank You ! @atmb4u

×