git rebase -i HEAD~3
now on the window that displays all the commits and messages, change all expect the first one from pick to squash
Typing "squash"
After the first step, the editor window will show up offering you to input the command for each commit. All you need to do is replacing pick with squash, starting from the second line. Then, save the file.
This will do the rebase operation.
Now to push it, do the below
git push --force-with-lease origin HEAD
references
https://www.w3docs.com/snippets/git/how-to-combine-multiple-commits-into-one-with-3-steps.html
No comments:
Post a Comment