I'm fairly new to git, so I've been trying to figure out how to squash 3 commits into 1 so my PR can get merged. I've read a lot of docs and guides and sort of found out how to squash commits but one of my commits aren't showing up. I tried attaching a photo of my commits and a photo of my terminal when I type in: "git rebase -i HEAD~5", but unfortunately I'm a new user so I can't? But anyway, I would greatly appreciate some help.
Suppose we want to squash the last commits. To squash commits, run the below command: $ git rebase -i HEAD ~3.
In case you are using the Tower Git client, using Interactive Rebase to squash some commits is very simple: just select the commits you want to combine, right-click any of them, and select the "Squash Revisions..." option from the contextual menu.
Squashing of commits means creation of a new commit instead of several. git reset
to the base commit of your branch and make a new one. Then just git push -f
to your branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With