Guest User

Untitled

a guest
Oct 20th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. ## General
  2.  
  3. * HEAD current commit on current branch
  4.  
  5. * git log
  6.  
  7. -1 : most recent one (1)
  8.  
  9. --stat : shows files changed in commit
  10.  
  11. --patch : shows differences in text
  12.  
  13. --pretty=oneline : flattens on t one line
  14.  
  15. --pretty=raw : more detail on commits (tree etc)
  16.  
  17. --graph : shows history graph
  18.  
  19. * git commmit --ammend
  20.  
  21. changes commit history (add changes and/or modify message)
  22.  
  23. * git reflog
  24.  
  25. show full history including rebased, modified, deleted commits etc (60 days)
  26.  
  27. * git diff
  28.  
  29. --color-words : shows only word changes in different colors
  30. --word-diff : makes word diffs machine parsable
  31.  
  32. * git reset HEAD@{3}
  33.  
  34. --hard : changes current head to back three commits (can lose files)
  35. --mixed : changes head, blows away staging (not touching working tree)
  36. --soft : changes only head
  37.  
  38. * git reset --hard
  39.  
  40. backs out current changes in working tree
  41.  
  42. * git revert [hash]
  43.  
  44. creates a new commit that removes a prior commit, use after push instead of rebase
  45.  
  46. * git ls-tree [hash-index]
  47.  
  48. show tree of a commit
  49.  
  50. * git cat-file -p [hash-index]
  51.  
  52. pretty print content of commit
  53.  
  54. * git config --global alias.lol "log --pretty=oneline --graph"
  55.  
  56. adds an alias for a one line log with graph (git lol)
  57.  
  58. * git rev-parse HEAD
  59.  
  60. show sha of indicated commit
  61.  
  62. * git push --prune
  63.  
  64. delete all upstream branches that have been deleted locally
  65.  
  66. ##REBASE
  67.  
  68. * git rebase -i HEAD~4 OR HEAD^^^^ OR HEAD@{4}
  69.  
  70. all mean 4 prior to head
  71.  
  72. * git commit --ammend
  73.  
  74. --ammend : when dropping an edit into a rebase, make changes, add them then ammend
  75.  
  76. * git rebase --continue
  77.  
  78. --continue : finishes rebase, allows for editing of commit message
  79.  
  80. * git pull --rebase
  81.  
  82. rebases the pull into current branch
  83.  
  84. * git config branch.autosetuprebase true
  85.  
  86. pull now does pull --rebase
Add Comment
Please, Sign In to add comment