aschuma

GIT :: Basics

Jun 23rd, 2015
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.95 KB | None | 0 0
  1. # Local Remote Branch Cleanup
  2. git fetch --prune
  3.  
  4. git checkout -b <branch> <commit>
  5.  
  6. # Reset to <commit>, keeping modified files in staging area
  7. git reset --soft <commit>
  8.  
  9. # Undoing local changes, removal from staging area
  10. git rm --cached <file>
  11. git reset HEAD <file>
  12. git reset <file>
  13. # Reset staging area and working directory
  14. git reset --hard
  15. git reset <commit>
  16. git reset HEAD~2
  17.  
  18. git clean [-n] # n == dry
  19.  
  20. git log -n <limit>
  21. git log --oneline
  22. # p == patch
  23. git log -p  
  24. git log --grep="<pattern>"
  25. git log <file>
  26. git log --graph --decorate --oneline
  27.  
  28. git checkout <commit> <file>
  29. git checkout <commit>
  30. git checkout HEAD
  31. git checkout HEAD <file>
  32.  
  33. # undo one commit (creates an undo patch of <commit>, applies the patch)  
  34. git revert <commit>
  35.  
  36. # i == interactive
  37. git rebase [-i] <branch>
  38.  
  39. # check which ignore rule matches
  40. git check-ignore -v *
  41.  
  42. # list tags
  43. git tag
  44. # rm tag
  45. git tag -d <tag>
  46. git push origin :refs/tags/<tag>
Advertisement
Add Comment
Please, Sign In to add comment