Skip to content

Instantly share code, notes, and snippets.

@loivis
Last active March 26, 2018 12:41
Show Gist options
  • Save loivis/e22dafdce2a2b878490b5246c5e963bc to your computer and use it in GitHub Desktop.
Save loivis/e22dafdce2a2b878490b5246c5e963bc to your computer and use it in GitHub Desktop.
git commands

http://zerodie.github.io/blog/2012/01/19/git-rebase-i/

  • start squash
git rebase -i sha1_of_last_unchanged_commit
  • pick commits to squash into
pick 033beb4 commit to be merged into
squash d426a8a commit to merge and disappear

# Rebase 49687a0..d426a8a onto 49687a0
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#
  • save and push changes
git push -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment