Git push -f vs. + [英] Git push -f vs. +

查看:88
本文介绍了Git push -f vs. +的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行操作有什么区别:

  git push -f origin my-branch:my-branch 

  git push origin + my-branch:my-branch 


<这些是针对同一个目标的两种语法。



除了 git push当 指定任何refspec(意味着您想将当前分支推送到远程匹配的名称分支)时,可以使用--force

它比:

  git push origin + yourBranch 

,如 Git社区所述Book



请参阅为什么git push helloworld + master:master而不是j ustgit push helloworld?以便说明。


What is the difference between doing:

 git push -f origin my-branch:my-branch

and

 git push origin +my-branch:my-branch

?

解决方案

Those are two syntaxes for the same goal.

Except that git push --force can be used when you don't specify any refspec (meaning you want to push your current branch to a remote matching name branch).
It is easier than:

git push origin +yourBranch

, as mentioned in the Git Community Book.

See "Why "git push helloworld +master:master" instead of just "git push helloworld"?" for illustration.

这篇关于Git push -f vs. +的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆