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?
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 authors.txt file mapping SVN usernames to Git identity strings before running the migration.
Key steps:
- Create
authors.txt:git svn log --authors-prog=... | sort -u > authors.txt - Run
svn2git <svn-url> --authors authors.txt --trunk trunk --branches branches --tags tags - Review the resulting history:
git log --oneline --graph - Handle SVN externals: these become submodule candidates; evaluate whether to inline the content or use proper Git submodules.
- Run
git lfs migrate importto move any large binary test fixtures to LFS before pushing. - Push to the new remote and set up branch protection rules.
- 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 10Mto 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 dcommitto 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
// Related questions
A QA repo is growing uncontrollably because large binary test fixtures (video recordings, DB dumps) are committed directly. How do you solve this?
Git
A QA engineer discovers that an API key was committed to the test repository 6 months ago and is still in Git history. What is your remediation plan?
Git
Describe the Git object model — blobs, trees, commits, and tags — and explain why this model makes Git operations fast and safe.
Git