Last active
August 29, 2015 14:25
-
-
Save andromedarabbit/6e5c52acdbb5860a88a9 to your computer and use it in GitHub Desktop.
Squash Commits with Git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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