Last active
November 28, 2018 14:36
-
-
Save darkmavis1980/da7dc31efe1de1005c33b25d1771c082 to your computer and use it in GitHub Desktop.
Squash commits
This file contains hidden or 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
// Squash the number of commits you want, 6 in this example | |
git reset --mixed HEAD~6 | |
// Stage all the files | |
git add -A | |
// Commit the staged files | |
git commit -m "Your message" | |
// Then update the remote using --force | |
git push --force origin <YOUR-BRANCH-NAME> | |
// Or use rebase | |
git rebase -i HEAD~6 | |
// then select the commits you want to squash by setting `s` instead of `pick`, after that save, | |
// and you will need to edit the commit message, and then you push force | |
git push --force origin <YOUR-BRANCH-NAME> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment