How to do a Force Push/Commit in GIT from command prompt

The below command will do a force push in GIT and will overwrite any changes that are not in your current code into remote repository

Example : Let us say the remote repository has a branch called “Master”

And the “Master” branch has changes from another person who has committed the wrong code and whereas you have the right code, then you can make use of a force push command as shown below

The command is

git push -u origin --all -f 


Scroll to Top