[英]Can you push an entire git repository to a branch of another (remote) repository
[英]Push entire remote git repository to another remote
我已經從錯誤的項目中分叉了我的項目(我分叉了),並且我想將GitHub存儲庫重置為從原始項目中分叉。 在GitHub中移動分叉涉及刪除和重新分支AFAIK。 唯一的問題是我想將舊的遠程分支引用推到新分支而不創建本地分支,因為(為了便於討論,我可以說)我有100個不同的分支,並且花太多時間檢查新的本地版本每個遠程分支。 (我的本地分支列表非常精簡,但通常將修復分支留在GitHub上)。
您可以在git push
使用正確的refspec
來實現這一點(步驟4):
refs/remotes/origin/...
重命名為refs/remotes/oldfork/...
: git remote rename origin oldfork
origin
遠程: git remote add origin <url>
git push origin 'refs/remotes/oldfork/*:refs/heads/*'
oldfork
遠程: git remote remove oldfork
如果您在原始fork中有自己的標簽,請在git push
命令行中添加--tags
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.