简体   繁体   English

将git分支移到另一个本地仓库

[英]Moving git branch to another local repo

I have two git repositories at /trees/repo and /trees/repo_recovered . 我在/trees/repo/trees/repo_recovered有两个git存储库。 The recovered version was manually copied over from a dying computer. 恢复的版本是从一台即将死机的计算机上手动复制的。 There is one un-pushed branch in this repo that I would like to move to /trees/repo . 我想移至/trees/repo ,此回购中有一个未推送的分支。 I could push this branch to the remote and then pull it down into the new repo, but I would prefer not to share this work yet. 可以将该分支推送到远程,然后将其下拉到新的仓库中,但是我不愿共享此工作。

How can I copy a branch (and all it's history) across the filesystem? 如何在整个文件系统中复制分支(及其所有历史记录)?

You could add another remote repository which just happens to be locally available on your file system. 您可以添加另一个恰巧在文件系统上本地可用的远程存储库。

git remote add recovered /trees/repo_recovered
git fetch recovered

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM