简体   繁体   中英

Moving git branch to another local repo

I have two git repositories at /trees/repo and /trees/repo_recovered . 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 . 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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