2012-07-23 71 views
0

我的最终目标是快速更新我的本地工作分支。如何获取仅与当前本地工作分支有关的信息?

在远程,有一个庞大的数据库包含许多分支和标签等。 一旦我将远程存储库同步(或克隆)到我的本地存储库中,当我执行'repo forall -c'git pull'以获取最新信息时,所有git项目的所有信息都将被检索,因此需要很长时间。

例如,my_local_working_branch_1对应于remote/working_branch_1。 在我的情况下,大约有300混帐项目my_local_working_branch_1

$ git branch 
my_local_working_branch_1 

$ repo forall -c 'git pull' 
remote : couting objects: ... 
remote : Compressing object: ... 
remote : Total ... 
From ssh://...... 
*[new branch] working_branch_2 
*[new branch] working_branch_3 
*[new tag] ... 
*[new tag] ... 

为了节省时间,我只想更新my_local_working_branch,它实际上是300个的Git项目,从远程/ working_branch。

我可以使用git fetch或git pull吗? 请详细说明。

如果你需要更多的信息来完全理解它,请让我知道。

谢谢。

回答

1

你可以是pull分支(你在做什么),或者fetch + rebase它。

git pull <remote> <branch> 

# the same as 

git fetch <remote> <branch> 
git merge <remote>/<branch> <local_branch> 

或者:

git fetch <remote> <branch> 
git rebase <remote>/<branch> <local_branch> 

我让你尝试这两种情况下,看看哪一个适合你。

+0

这是我目前关于GIT branch&config的描述。 $ git的分支 my_local_working_branch_1 $混帐配置-l remote.mps-git.url = SSH:// .... remote.mps-git.review = .... remote.mps,混帐.projectname = .... branch.my_local_working_branch_1.remote = mps-git branch.my_local_working_branch_1.merge = refs/remote// head/working_branch_1 根据你的回答,哪一个是正确的? $ git的拉MPS-混帐my_local_working_branch_1 或 $ git的拉working_branch_1 my_local_working_branch_1 在此先感谢。 – 2012-07-23 08:29:02

+0

'git pull mps working_branch_1'。你需要在'my_local_working_branch_1'分支上。如果你不是,首先移动它:'git co my_local_working_branch_1'。 – 2012-07-23 09:13:42

相关问题