2013-11-24 56 views

回答

4

好的,在此期間,我想我猜你的意思是分叉。根據你在github上分支的問題標籤!對?

好吧,那很容易。 github上的fork基本上是你按下fork按鈕的倉庫的克隆。

要重新連接到你做你的本地計算機上執行以下步驟原來的倉庫:

比如並且嘗試我已付出這個libgit2 ...

$ git clone https://github.com/MyOwnAccount/libgit2.git 
Cloning into 'libgit2'... 
remote: Counting objects: 43058, done. 
remote: Compressing objects: 100% (16412/16412), done. 
remote: Total 43058 (delta 30556), reused 37875 (delta 25761) 
Receiving objects: 100% (43058/43058), 12.22 MiB | 942 KiB/s, done. 
Resolving deltas: 100% (30556/30556), done. 
Checking out files: 100% (2432/2432), done. 

$ git remote -v 
origin https://github.com/MyOwnAccount/libgit2.git (fetch) 
origin https://github.com/MyOwnAccount/libgit2.git (push) 

$ git remote add forkOrigin https://github.com/libgit2/libgit2.git 

$ git remote -v 
forkOrigin https://github.com/libgit2/libgit2.git (fetch) 
forkOrigin https://github.com/libgit2/libgit2.git (push) 
origin https://github.com/MyOwnAccount/libgit2.git (fetch) 
origin https://github.com/MyOwnAccount/libgit2.git (push) 

$ git fetch forkOrigin 

$ git fetch --tags forkOrigin 

現在你把所有的最新的提交,分叉和標籤從您分叉的地方分叉。 (您可以使用rebase或直接在遠程分支上合併 - 在這一點上按照您的喜好/需要進行操作,取指只是現在顯示的最簡單的方式)

使用此提取的數據,您可以合併,rebase,像往常一樣選擇等等。

如果稍後將更改推送到您自己的存儲庫,則完成了。

+0

這對Milad有幫助嗎?然後你可以接受答案。否則請詢問。祝您的項目好運! –

+0

是的,工作。謝謝 – Milad

0

如果您使用GitHub作爲您帖子建議的github,那麼您可能會將原始回購分錄分配給您的GitHub帳戶,然後從您的分支克隆。你可以從原始回購而不是你的分叉克隆,但我會假設第一個案例。

當你從fork中克隆時,git會自動爲它創建一個名爲origin的遠程。爲了從原來的回購的變化,首先你要添加遠程吧,讓我們把它other

git remote add other the_github_url 

接下來,得到這個回購的分支:

git fetch other 

您可以使用稍後再用相同的命令來獲取在該回購中提交的新更改。

您可以在其他遠程與查看分支:

git branch -r 

您可以在其他的主合併遠程與您的當前分支:

git merge other/master 

也就是說,您使用遠程名稱後跟斜槓,然後是分支名稱。