Wednesday, June 22, 2016

Squashing Git Commits:

1) git checkout [branch_name]
2) git reset master
3) git status // if there are new files, add them for staging
4) git commit -a -m "squashed"
5) git push origin HEAD:[squashed_branch_name] // Notice the new remote branch. Then you can diff the two and ensure the squash worked correctly.
6) git diff // If there were no differences, you can force commit the changes to your branch
7) git push origin [branch_name] -f