Skip to content

Instantly share code, notes, and snippets.

@andromedarabbit
Last active August 29, 2015 14:25
Show Gist options
  • Save andromedarabbit/6e5c52acdbb5860a88a9 to your computer and use it in GitHub Desktop.
Save andromedarabbit/6e5c52acdbb5860a88a9 to your computer and use it in GitHub Desktop.
Squash Commits with Git
# ref: http://davidwalsh.name/squash-commits-git
# switch to master branch
git checkout master
# ensure our master is up to date
git pull remoteRepoName master
# use git rebase to consolidate
git rebase -i master
# Edit the summary shown to you by the rebase command, leaving the commit you want to be the main commit as "pick" and changing all subsequent "pick" commands as "squash":
#
# pick fb554f5 This is commit 1
# squash 2bd1903 This is commit 2
# squash d987ebf This is commit 3
# Force a push
git push -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment