git push -f

Posted 南瓜

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git push -f相关的知识,希望对你有一定的参考价值。

有的时候使用GIT工作时,会遇到一下这种问题,
Pushing to [email protected]:519ebayproject/519ebayproject.git
To [email protected]:519ebayproject/519ebayproject.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to ‘[email protected]:519ebayproject/519ebayproject.git‘
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. ‘git pull‘)
hint: before pushing again.
hint: See the ‘Note about fast-forwards‘ in ‘git push --help‘ for details.
我遇到造成这个问题的原因,一般是因为执行了git reset命令,版本回退后没有恢复,造成本地仓库的提交版本号落后于远端仓库的提交版本号。
可以执行 git push -f命令去强制提交

以上是关于git push -f的主要内容,如果未能解决你的问题,请参考以下文章

git push/pull 对应分支

git push 与 git push heroku master

git push 详细手册

Git的push权限

sh [git pull / push] pull或push命令#git #bash #linux

git push 报错:failed to push some refs to 'git@git.xxxx:devops/thor.git'