我想克隆遠程回購到我的本地工作區,並將內容推送到一個新的裸回購我設置維護,此回購需要偶爾從上游回購更新和新內容也需要推送到本地回購。將遠程內容合併到本地回購
這裏是一個例子:
git clone ssh://[email protected]/project
和我創建了一個裸回購作爲project_local
mkdir project_local.git
git init --bare --share=2 project_local.git
一旦遠程回購在我的工作區的克隆的,因爲這個遠程回購有多個分支,
branch1
branch2
.
.
branchN
這就是我所做的從遠程獲取所有分支並推送到我的位置我裸露的回購。
cd project
git branch -a >&/tmp/branchinfo
sed s,.*/,, /tmp/branchinfo >&/tmp/branchinfo1 #this remove everything before the last '/' before the actual name of the branch
for i in `cat /tmp/branchinfo1`; do git checkout $i; done #checkout all the branches from remote site.
for i in `cat /tmp/branchinfo1`; do git push project_local.git $i; done # Push all the remote branches to local repo I created with all contents.
在此之後,從遠程回購的內容現在是在我的本地裸回購,但我怎麼能提取和合並在當地的回購我創建的各個分支,以相應的分支機構所有遠程變化?
我曾嘗試使用'git remote add',但只提取refs,它實際上並不執行合併內容。
非常感謝您提供任何幫助。
謝謝
添加遙控器後,您做了拉動嗎?此外,如果你有你的遙控器配置正確,我相信所有追蹤的分支將被推在同一時間,當你做一個「混帳推」 –
我做了一個拉,但它告訴我像沒有正確配置,並推動沒有工作,如何正確設置配置文件,對不起,如果這個問題似乎有點愚蠢,但我是新來的混帳。謝謝 –