How do I properly force a Git push?

Just do:

git push origin <your_branch_name> --force

or if you have a specific repo:

git push https://git.... --force

This will delete your previous commit(s) and push your current one.

It may not be proper, but if anyone stumbles upon this page, thought they might want a simple solution…

Short flag

Also note that -f is short for --force, so

git push origin <your_branch_name> -f

will also work.

Leave a Comment