I'm working on a program to migrate multiple repos from a git server to a Gitlab one. The migration part is already done and now I want to check if everything went okay and that all the repos were migrated properly.
What is the best way to do that ?
I'm working on a program to migrate multiple repos from a git server to a Gitlab one. The migration part is already done and now I want to check if everything went okay and that all the repos were migrated properly.
What is the best way to do that ?
Clone the code from gitlab
git clone <gitlab-repo-url>
Add the git server repo url as a remote on your local repo
cd <repo>
git remote add oldserver <git-server-repo-url>
Run git fetch for both remotes
git fetch --all
Run git log showing commits from all your remotes
git log --decorate=short --oneline --remotes=* --branches=*
If you see both remotes master branches pointing to the same commit, it's a strong indicator migration went well
e4bf7c2 (master, origin/master, oldserver/master) Latest commit message
9d5339c A previous commit message
fe43ce7 Other commit message
origin/master is the master branch on gitlab
oldserver/master is the master branch on old git server
In repo_a:
git remote add -f b path/to/repo_b.git
git remote update
git diff master remotes/b/master
git remote rm b
I know it's an old question but I ran into the same requirement recently. I was thinking to find a tool to solve it but with no luck. After some searching here's a solution to compare two whole repo not only a specific branch.
git clone --mirror path/to/repo_a.git old/repo_a.git
git clone --mirror path/to/repo_b.git new/repo_b.git
git diff --name-only --no-index old/repo_a.git new/repo_b.git | wc -l | xargs test 1 -lt && echo 'repo not the same!'
clone with --mirror option will clone the whole repo without working tree into a directory. diff with --no-index could be used to compare the whole directory. If the content of repo are the same, then only the url in config file will be different.
P.S. You'll have to clone both repo with the same protocol. For some unknown reason it'll produce different file when using different protocol. That way the output of diff will indicate more difference.