git仅为当前分支提取 [英] git fetch only for current branch

查看:147
本文介绍了git仅为当前分支提取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以获取任何远程分支到任何本地分支,但是是否还有某种快捷方式可以从跟踪的远程分支获取当前跟踪本地分支(无需明确指定本地和远程分支名称)?

动机:我想为当前分支获取远程更改,以避免从当前不相关的分支获得(也许很大)更改。我将在稍后的一个单独步骤中合并/重新绑定。

我们假设您有 原始

使用 开发 分支。
您想同步 master ,但不是 开发

您可以执行以下步骤:

  git fetch origin 
git merge origin / master

更新:如果只有分支必须被提取:

  git fetch origin master 
git merge FETCH_HEAD


I know that I can fetch any remote branch to any local branch, but is there also some kind of shortcut to fetch just from the tracked remote branch to the current tracking local branch (without the need to specify the local and remote branch names explicitly)?

Motivation: I want to just fetch remote changes for the current branch to avoid getting (maybe large) changes from currently irrelevant branches. I will merge/rebase later in a separate step.

解决方案

Let's assume that you have origin remote with master, develop branches. You want to sync master but not develop.

You can do the following steps:

git fetch origin
git merge origin/master

UPDATE: in case of only branch have to be fetched:

git fetch origin master
git merge FETCH_HEAD

这篇关于git仅为当前分支提取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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