Warum migrieren
Mercurial und Git sind Schwester-Systeme.
Das Standardtool: fast-export
git clone https://github.com/frej/fast-export.git
cd ~/path-to-hg-repo
git init ../git-repo
cd ../git-repo
~/fast-export/hg-fast-export.sh -r ../path-to-hg-repo
git checkout HEAD
Autoren-Mapping
# authors.txt
"Jane Doe" = "Jane Doe <[email protected]>"
"bob" = "Bob Smith <[email protected]>"
~/fast-export/hg-fast-export.sh -r ../hg-repo -A authors.txt
Branch-Behandlung
- Mercurials named branches sind permanente Labels.
- Git-Branches sind veranderliche Zeiger.
Geschlossene Branches
git for-each-ref refs/heads/closed-* --format='%(refname:short)' \
| xargs -n 1 git branch -D
Tags
hg tags
git tag
Integritat verifizieren
hg log --template '{node}\n' | wc -l
git log --all --pretty=format:'%H' | wc -l
hg cat -r <hg-rev> path/to/file > /tmp/hg-file
git show <git-sha>:path/to/file > /tmp/git-file
diff /tmp/hg-file /tmp/git-file
Zu einem Git-Host pushen
git remote add origin https://github.com/team/repo.git
git push -u origin --all
git push origin --tags
Workflow-Ubersetzung
Mercurial-Benutzer sind oft schockiert von Git's Index.
Erweiterungen und Hooks
mq → git rebase -i. histedit → auch git rebase -i.
Nachsorge
Mercurial-Repo mindestens einen Release-Zyklus read-only halten.