如何在不签出的情况下拉一个git分支? [英] How to pull a git branch without checking it out?
问题描述
我在定期处理的存储库(发行版+开发版)中有2个分支.但是,当在分支之间切换时,它会触发我的项目中的较长构建(我在说的是30分钟左右),因此我宁愿避免在它们之间进行切换.为了能够同时工作,我创建了2个存储库副本,并且效果很好.
但是,当我想合并更改时,需要使release分支处于活动状态以拉出更改.然后,我可以切换回开发,进行合并和提交.但是,正如我在上面所述,此开关将导致较长的重建时间.有没有其他方法可以在不先使它处于活动状态的情况下拉它的分支?
您可以获取
远程更改.这将从远程存储库下载所有更改,但仅此而已.但是,如果您想将 A
分支 A
合并到分支 B
中,则必须先检出 B
才能做到这一点./p>
git pull
只不过是 git fetch
与 git merge
I have 2 branches in a repository (release + dev) that I work regularly on. However, when switching between branches it triggers a long build in my project (I'm talking about ~30mins) so I'd rather avoid to switch between them. In order to work in both I created 2 copies of my repository and that works fine.
However, when I want to merge the changes I need to make the release branch active for a moment to pull changes. Then I can switch back to develop, do the merge and commit. However, as I wrote above this switch will cause a long rebuild. Is there another way to pull a branch without first making it active?
You can fetch
remote changes. This will download all changes from the remote repository but will do nothing more. But if you want to merge
branch A
into branch B
you cannot do that without checking out B
before.
git pull
is nothing more than a git fetch
combined with a git merge
这篇关于如何在不签出的情况下拉一个git分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!