origin / branch_name和branch_name之间的区别? [英] difference between origin/branch_name and branch_name?
问题描述
推送到bitbucket。
如果我这样做: git push origin origin / branch_name
我的提交不是
pre $ code>总共0(delta 0),重用0(delta 0)
如果我做了 git push origin branch_name
我的提交被推送:
计数对象:160,完成。
使用多达8个线程的增量压缩。
压缩对象:100%(13/13),完成。
写作对象:100%(20/20),2.10 KiB | 0字节/秒,完成。
总计20(delta 6),重用0(delta 0)
那么什么是来源/意思在branch_name前面?为什么它很重要?
你必须记住有不同类型的分支:
- (纯粹)本地分支,即您承诺的分支
- 分支住在远程存储库中,因为缺乏更好的术语。您可以使用远程名称知道远程存储库,例如
origin
。然而,从存储库的角度来看,这样一个分支是 local 。欢迎使用分布式版本控制!:)
- 远程追踪分支。也简称为远程分支机构,如 Pro Git book ,但我觉得这句话很混乱; 远程追踪分支更准确。他们是特殊的本地分支,其唯一目的是反映您最后一次与服务器通信时存在于远程存储库中的分支的状态。特别是,你不能提交这种类型的分支。
这里, branch_name
是一个 local 分支,而 origin / branch_name
是一个远程跟踪分支;它反映了居住在原点
中的相应分支的状态。
运行
git fetch
远程跟踪分支 origin / master
和相应的分支,位于原始
应完全同步(当然,模并发推送到远程服务器)。那么,应该不会感到意外的是,
git push origin origin / branch_name
不会推送任何东西:您基本上试图推送已存在于相应的分支的祖先中的东西在 origin
。
然而,如果你的 local code> branch_name ,超前于一个或多个提交,
然后运行
git push origin branch_name
会将包含在 for pushing to bitbucket. If I do: If I do so what is the origin/ mean in front of the branch_name? And why does it matter? You have to remember that there are different types of branches: Here, Right after running the remote-tracking branch doesn't push anything: you're essentially attempting to push stuff that is already present in the ancestry of the corresponding branch that live in However, if your local branch, then running will push the commits contained in 这篇关于origin / branch_name和branch_name之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! branch_name
但不在位于原点$>的分支中:
git push origin origin/branch_name
my commits are not pushed.Total 0 (delta 0), reused 0 (delta 0)
git push origin branch_name
my commits are pushed:Counting objects: 160, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (20/20), 2.10 KiB | 0 bytes/s, done.
Total 20 (delta 6), reused 0 (delta 0)
origin
. From that repository's point of view, though, such a branch is local. Welcome to Distributed Version Control! :)
branch_name
is a local branch, whereas origin/branch_name
is a remote-tracking branch; it reflects the state of the corresponding branch that lives in origin
.git fetch
origin/master
and the corresponding branch that live in origin
should be perfectly in sync (modulo concurrent pushes to the remote server, of course). It shouldn't be a surprise, then, that git push origin origin/branch_name
origin
.branch_name
, is ahead by one or more commits,git push origin branch_name
branch_name
but not in the branch that live in origin
: