Squashing

suggest change

Squashing is the process of taking multiple commits and combining them into a single commit encapsulating all the changes from the initial commits.

Squashing and Remote Branches

Pay special attention when squashing commits on a branch that is tracking a remote branch; if you squash a commit that has already been pushed to a remote branch, the two branches will be diverged, and you will have to use git push -f to force those changes onto the remote branch. Be aware that this can cause issues for others tracking that remote branch, so caution should be used when force-pushing squashed commits onto public or shared repositories.

If the project is hosted on GitHub, you can enable “force push protection” on some branches, like master, by adding it to Settings - Branches - Protected Branches.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents