2014-07-17 37 views

回答

7

您當地的git存儲庫根據「遙控器」確定推/拉的位置。現在,您的本地存儲庫有兩個遠程文件,origin(它現在指向您克隆的Github存儲庫)和heroku(它指向Heroku存儲庫)。

您將源分叉到Github上的新存儲庫;假設舊的是https://github.com/bob/website.git,你的叉子是https://github.com/pixelfairy/website.git

如果你

git remote -v 

你應該看到類似

origin https://github.com/bob/website.git (fetch) 
origin https://github.com/bob/website.git (push) 
... 

我們可以改變這個使origin點到你的叉子。不要

git remote set-url origin https://github.com/pixelfairy/website.git 

現在git remote -v應該輸出

origin https://github.com/pixelfairy/website.git (fetch) 
origin https://github.com/pixelfairy/website.git (push) 
... 

現在,您可以pushpull像之前,它會使用你的叉子,而不是原先克隆庫。

+0

現在嘗試這個。謝謝!! – pixelfairy

+0

完美工作。謝謝!!! – pixelfairy

1

只需添加到@tbekolay答案,如果需要,您仍然可以從被克隆的原始分支中獲取/拉出,以便跟上從那裏進行的更改。通過添加仍然指向原始遙控器(本例中爲bob)的「上游」(或其他指定的)遙控器來實現。

git remote add upstream https://github.com/bob/website.git 

然後你就可以通過拉動從那裏不時更新代碼:

git pull upstream <branch name> 

如果你想改變新的遠程使用:

git remote set-url upstream <new url> 
相關問題