2012-07-23 42 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

相關問題