-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Squashing Commits
Kevin Mulhern edited this page Mar 20, 2022
·
5 revisions
git rebase -i main
- Replace
pick
at the start of each line except the top line withs
( which stands for squash) then save.
Example:
pick 47a32d7e WIP: first Commit
s bc0037a1 WIP: second Commit
s c5b81945 WIP: third Commit
-
You should now be able to reword the first commit with the normal
because
andThis commit
template we use - example here -
Pushing to remote
If you have already pushed to the remote previously
Warning: only force push if you are the only one working with on the branch. Never force push to branches anyone else is working on, and especially never force push to the main branch
- You will have to force push your branch because your commits have been rebased:
git push -f
Otherwise, if this is the first time pushing the branch to the remote
- Then push as normal
git push
- You will have to force push your branch because your commits have been rebased:
Wiki Home | Odin Web App Home | Odin Site Home | Odin Org Home
Want to contribute to this wiki? Open an issue to suggest changes and improve these docs 🚀