Created by KatieLinked to 97.7m issues across 225 teams
This tutorial will explain how to properly force a Git push.
First, open your terminal and navigate to the directory containing the repository you want to push.
git push origin <your_branch_name> --force
... and press enter. This will delete your previous commit(s) and push your current one.
Alternatively, you can use the short flag
-f instead of
--force. To do this, follow the same process but with the following code:
git push origin <your_branch_name> -f
If you have a specific repository, you can use the following command to force the push:
git push https://git.... --force` or `git push https://git.... -f