Force Pushing

suggest change

Sometimes, when you have local changes incompatible with remote changes (ie, when you cannot fast-forward the remote branch, or the remote branch is not a direct ancestor of your local branch), the only way to push your changes is a force push.

git push -f

or

git push --force

Important notes

This will overwrite any remote changes and your remote will match your local.

Attention: Using this command may cause the remote repository to lose commits. Moreover, it is strongly advised against doing a force push if you are sharing this remote repository with others, since their history will retain every overwritten commit, thus rending their work out of sync with the remote repository.

As a rule of thumb, only force push when:

Feedback about page:

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



Table Of Contents