gitmigrationrepositorygitlabintegrity

Checking git repos after migration


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 ?


Solution

  • 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