从特定的分支拉到特定的分支 [英] git pulling FROM a specific branch TO a specific branch

查看:98
本文介绍了从特定的分支拉到特定的分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用github回购作为我们的中央存储库。



我们计划让多个编码器以如下方式在登台服务器上工作: p>


  1. 编码器在其本地回购库上的单独分支上工作;
  2. 编码器将更改推送到github;然后

  3. 编码器将更新从github提取到服务器repo

因此,在实践中,第3步,编码人员将在暂存存储库中运行以下代码:

git checkout coderA-updates

git pull origin coderA-updates

git checkout master



有没有办法更新一个特定的分支而不必首先 git checkout 它?






TLDR:
你如何做一些像 git pull origin remoteBranch localBranch 切换活动分支?



感谢:)

解决方案

使用 fetch

  git fetch origin remoteBranch:localBranch 

这仅适用于默认情况下的快速更改(请参阅 docs )。

We are using a github repo as our "central repository".

We are planning to have multiple coders working on the staging server in the following manner:

  1. Coders work on a separate branch on their local repo;
  2. Coders push changes to github; and then
  3. Coders pull updates from github to server repo

So, in practice, on Step 3, coders will run the following on the staging repo:

git checkout coderA-updates
git pull origin coderA-updates
git checkout master

Is there a way to update a specific branch without having to git checkout it first?


TLDR: How do you do something like git pull origin remoteBranch localBranch without having to switch active branches?

Thanks :)

解决方案

Use a plain fetch:

git fetch origin remoteBranch:localBranch

This will only work for fast-forward changes by default (see the docs).

这篇关于从特定的分支拉到特定的分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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