Import all branches of one Git repository into another one
- Git repository OLD:
- master (manually tracking the CVS branch OLD_VERSION)
- Git repository CURRENT:
- master (manually tracking HEAD of the CVS repository)
I now want to import all branches from OLD into CURRENT, with some prefix added (e.g. OLD-master, OLD-feature-abc-backport, OLD-feature-xyz). Is this possible?
One Solution collect form web for “Import all branches of one Git repository into another one”
Importing a branch is possible.
Manage it once imported can be trickier.
cd current git remote add old /url/to/git/old git fetch old git branch --track old_master old/master git branch --track old_feature-abc-backport old/feature-abc-backport git branch --track old_feature-xyz old/feature-xyz
The question is: are the commits of the git ‘old’ repos the same as the ones in the git ‘current’ repo?
If yes, then you can merge an
old_xxx branch in a
current branch, since the delta would be limited.
Actually, I would like to do the import mainly for archival purposes, at least in the first step. When a branch goes out of maintenance
Then a simple fetch is enough:
All the branches from old will be immediately references as
old/abranch: no need to create a local branch with a ‘old_’ prefix.
Their full history will be available in your current repo (after the fetch), and each
HEAD will be references by the remote tracking branches (created by the fetch) in