[英]What are local branch,remote tracking local branch, remote branch
I have started working with Git recently. 我最近开始与Git合作。 Normally I use eclipse Egit and very rarely git shell. 通常我使用Eclipse Egit,很少使用git shell。 After going through a lot of material on Git and its branching, I still have confusion regarding that. 在讨论了有关Git及其分支的大量材料之后,我对此仍然感到困惑。
I know there are n number questions on Stack Overflow on the same topic but so far I have only either added to my confusion or I have got half baked knowledge on branching. 我知道关于同一主题的Stack Overflow上没有n个问题,但到目前为止,我只是加深了困惑,或者对分支有了半熟的知识。 So I am putting the n + 1st question on this regarding my understanding. 因此,关于我的理解,我要提出第n + 1个问题。
Can somebody confirm if my understanding is correct: 有人可以确认我的理解是否正确:
The remote-tracking-ness of a local branch affects only the pull
and push
operations. 本地分支的远程跟踪能力仅影响pull
和push
操作。 But not fetch
. 但是不能fetch
。 It allows you to omit a few arguments when you type these commands. 当您键入这些命令时,它允许您省略一些参数。
For instance the local master is remote-tracking origin/master. 例如,本地主机是远程跟踪源/主机。 To pull in the new commits from origin/master into the local master, you have to make sure your local master is checked out and then: 要将新提交从原始/母版拉入本地母版,必须确保已检出本地母版,然后:
git pull origin master
But as master is remote-tracking origin/master, it's enough to say: 但是,由于master是远程跟踪的原点/ master,因此可以这样说:
git pull
So remote-tracking is mostly syntactic sugar. 因此,远程跟踪主要是语法糖。
(For future readers) (供将来的读者使用)
I agree with the assumptions of the author of the question from 1 to 4. However (5) master can not track origin/master when fetch. 我同意问题作者从1到4的假设。但是(5)主机在获取时无法跟踪来源/主机。
When fetch (6), only origin/master is updated, so it is tracking the remote branch (6.1. is true). 提取(6)时,仅更新了原始服务器/主服务器,因此它正在跟踪远程分支(6.1。是)。
However, for the local master and the working dire you have to merge or rebase (even better the second one) (6.2 and 6.3. are false). 但是,对于本地管理员和工作困境,您必须合并或调整基准(甚至更好的是第二个基准)(6.2和6.3。是错误的)。
Same way, for push, you push your master in origin (name of remote repository). 同样,对于推送,您将主服务器推送到源服务器(远程存储库的名称)中。 Your local repo is when the changes of your working dir have been commited, so your working dir is not automatically pushed, is your local repo. 本地存储库是提交工作目录更改后的工作目录,因此不会自动推送您的工作目录,这是您的本地存储库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.