Q37 of 40 · Git

Your organisation is migrating from SVN to Git. What are the key steps and the main risks for the QA test repository?

GitSeniorgitsvnmigrationsvn2githistory

Short answer

Short answer: Use `git svn clone` or `svn2git` to import history with author mapping. Key risks: SVN externals become submodules (painful), binary test assets bloat Git history, branch/tag mapping needs manual curation, and developer re-training takes time.

Detail

Migration tools: git svn clone (built into Git) or svn2git (a Ruby wrapper with better author/tag handling). For large repos, svn2git is preferred because it correctly converts SVN tags to Git annotated tags and handles the standard trunk/branches/tags layout.

Author mapping: SVN stores committer usernames; Git stores "Name ". Create an authors.txt file mapping SVN usernames to Git identity strings before running the migration.

Key steps:

  1. Create authors.txt: git svn log --authors-prog=... | sort -u > authors.txt
  2. Run svn2git <svn-url> --authors authors.txt --trunk trunk --branches branches --tags tags
  3. Review the resulting history: git log --oneline --graph
  4. Handle SVN externals: these become submodule candidates; evaluate whether to inline the content or use proper Git submodules.
  5. Run git lfs migrate import to move any large binary test fixtures to LFS before pushing.
  6. Push to the new remote and set up branch protection rules.
  7. Update CI/CD pipelines to point at the new Git repo.

QA-specific risks:

  • Binary test assets: screenshots, DB dumps committed to SVN will bloat Git history. Use git filter-repo --strip-blobs-bigger-than 10M to clean up.
  • SVN keywords ($Rev$, $Date$): these expand in SVN but become static strings in Git — test code that relies on them will need updating.
  • Parallel operation period: run SVN and Git in parallel until confidence is established, using git svn dcommit to sync Git commits back to SVN.

// EXAMPLE

# Step 1: generate author mapping
svn log --xml https://svn.company.com/repos/qa-tests |   grep author | sort -u |   perl -pe 's/<author>(.*?)</author>/$1 = $1 <$1@company.com>/'   > authors.txt

# Edit authors.txt:
# jsmith = John Smith <john.smith@company.com>
# abrown = Alice Brown <alice.brown@company.com>

# Step 2: migrate with svn2git
svn2git https://svn.company.com/repos/qa-tests   --authors authors.txt   --trunk trunk   --branches branches   --tags tags

# Step 3: move large files to LFS
git lfs migrate import --include="*.zip,*.mp4,*.sql" --everything

# Step 4: push to GitHub
git remote add origin https://github.com/company/qa-tests.git
git push --all origin
git push --tags origin

# Step 5: verify tag conversion
git tag -l | head -10
git cat-file -t v1.2.0   # should be 'tag' (annotated), not 'commit'

// WHAT INTERVIEWERS LOOK FOR

svn2git over raw git svn (better tag handling). Author mapping file. Handling SVN externals and keywords. LFS migration for binary assets. Parallel operation period. This is a rare senior signal — most engineers have only done this once or twice.