Created
January 12, 2012 22:07
-
-
Save PaulMcMillan/1603441 to your computer and use it in GitHub Desktop.
Easy squashing for a bunch of commits
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
# The easiest way to turn multiple commits in a feature branch into a single commit | |
# is to reset the feature branch changes in the master and commit everything again. | |
# Switch to the master branch and make sure you are up to date. | |
git checkout master | |
git fetch # this may be necessary (depending on your git config) to receive updates on origin/master | |
git pull | |
# Merge the feature branch into the master branch. | |
git merge feature_branch | |
# Reset the master branch to origin's state. | |
git reset origin/master | |
# Git now considers all changes as unstaged changes. | |
# We can add these changes as one commit. | |
# Adding . will also add untracked files. | |
git add . | |
git add -u # The -u option also adds file deletions. | |
git commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment