Search code examples
gitrepositorygit-push

Difference between git push -f vs git push origin +master


Suppose I want to delete last commit from local and remote repository by git reset –hard HEAD~ then git push -f or git push origin +master

as I found both method is used to force push. Is there any difference between above two push command or they worked as same ?


Solution

  • See the manual: -f also overrules --force-with-lease, plus: the -f works on all the refs that you push, in case you push multiple at the same time.