Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1.  
  2. Git Cheat Sheet
  3. ===============
  4.  
  5. Getting a remote branch without merging
  6. ---------------------------------------
  7.  
  8. git fetch origin my-branch
  9.  
  10. Aliasing Commands
  11. -----------------
  12.  
  13. Tired of typing out git command? Add an alias to make things easier.
  14.  
  15. git config --global alias.co checkout
  16.  
  17. This is one I normally use. I alias 'co' to checkout, so to checkout a branch I use:
  18.  
  19. git co my-feature
  20.  
  21. Rebasing
  22. --------
  23.  
  24. If multiple branches are being worked on in parallel it is necessary to keep git commit history up to date
  25.  
  26. If you are working on branch my-feature and changes were made to master you can update your commit history with `git rebase`
  27.  
  28. git checkout my-feature
  29. git rebase master
  30.  
  31. When doing a rebase you can specify interactive mode to modify commit history.
  32.  
  33. git rebase -i master
  34.  
  35.  
  36. Another way to squash commits
  37. -----------------------------
  38.  
  39. A really simple way to squash commits is to do a soft reset of your local branch with respect to another branch.
  40.  
  41. git checkout my-feature
  42. git reset --soft master
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement