简体   繁体   English

Git拉/推在不同的分支

[英]Git pull/push in different branches

There are a zillion questions about this all over teh internet but I just can't seem to find an easy enough answer to grasp and wrap my head around. 关于互联网的这个问题有很多问题,但我似乎无法找到一个足够简单的答案来掌握和包围我的头脑。 The difference in how push/pull can be a bit confusing. 推/拉方式的差异可能有点令人困惑。

When using git pull/push it is possible to push from a local branch A to the remote branch B using git push origin A:B . 当使用git pull / push时,可以使用git push origin A:B从本地分支A推送到远程分支B. This much is clear. 这很清楚。

If I'm on branch C locally and wish to get content from remote branch D, is it enough to do git pull origin D ? 如果我在本地分支C并希望从远程分支D获取内容,那么git pull origin D就足够了吗?

Or would I have to do something like git pull origin C:D (or D:C) ? 或者我必须做一些像git pull origin C:D (or D:C)事情?

I've tried to read the man pages on how pull works in between branches but I haven't been able to solidly understand it so I'm asking you. 我已经尝试阅读关于如何在分支之间工作的手册,但是我还没有能够理解它,所以我问你。

Cheers. 干杯。

git pull origin D is enough. git pull origin D就足够了。 This will fetch and merge branch D into your current branch. 这将获取并将分支D合并到当前分支中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM