How do I move a code repository while preserving branches and tags?
Quick answer
Before switching, compare the source and destination repository’s branch names, tag names, and commit history. For GitHub’s documented command-line import route, a bare clone followed by a mirror push copies references such as branches and tags; large files may cause a warning or error. [S1] Verify the result rather than assuming the transfer worked, and separately check settings and collaboration records because source-code imports do not necessarily include them. [S2]
The question, the details, the next step.
A practical checklist
Record the source repository and the transfer method before beginning.
Create a baseline list of expected branch and tag names.
Compare destination branches and tags against the source baseline.
Review expected commit history on important branches.
Investigate transfer warnings or errors, including any involving large files.
Track settings and collaboration data separately from code and revision history.
Document unresolved differences before the team switches to the destination.
A few more useful answers
If the branch and tag names match, is that enough to approve the move?
No. Also review the expected commit history and investigate warnings or errors. Matching names are one check, not proof that all expected content arrived.
Will the same import steps work on every hosting platform?
The cited procedure is specifically GitHub’s command-line import route, not a universal guarantee. Check the destination host’s guidance for the method you plan to use.
Should we switch the team over immediately after the transfer?
First compare the destination with your source baseline, record unresolved differences, and review any separately required settings or collaboration data. Switch only after the appropriate repository owner has reviewed the results.
Sources
References used for this guide.
- [S1] Importing an external Git repository using the command line docs.github.com · Checked
- [S2] About source code imports using the command line docs.github.com · Checked
