# PREP WORK git clone --depth=1 --branch=master https://github.com/frej/fast-export.git curl "http://repo1.maven.org/maven2/com/madgag/bfg/1.12.15/bfg-1.12.15.jar" -o /bfg.jar mkdir # TO CREATE A GIT REPO AT FROM cd hg log | grep user: | sort | uniq | sed "s/user: *//" > /authors.txt cd python /authors.py cp /* . git init git config core.ignoreCase false sh hg-fast-export.sh -r --force -A reformatted-authors.txt # WARNING !!! # ----------- # VSERVER HAS DIFFICULTY RUNNING HG-FAST-EXPORT AFTER THE FOLLOWING HAVE BEEN DONE. # DO NOT EXECUTE ANY OF THE FOLLOWING UNTIL YOU ARE SURE GIT NO LONGER NEEDS TO SYNC WITH HG!! # TO CLEAN UP LARGE FILES git gc java -jar /bfg.jar --strip-blobs-bigger-than git reflog expire --expire=now --all git gc --prune=now --aggressive # TO DELETE ALL CLOSED BRANCHES cd hg heads --closed --template "{branch}\n" | tr " " "_" | sort > /all.log hg heads --template "{branch}\n" | tr " " "_" | sort > /open.log cd comm -2 -3 all.log open.log > closed.log for branch in `cat closed.log`; do git tag "closed/$branch" $branch; git branch -df $branch; done # BEFORE GOING LIVE git checkout master -f git clean -df * create .gitignore: find . -name ".hgignore" > hgignore-files.log for file in `cat hgignore-files.log`; do newfile=${file/hgignore/gitignore}; cp $file $newfile; sed -E -i.bak "s/syntax:/#syntax:/; s/^\^//; s/\$$//; s/\\\w\+/*/; s/\\\\\//\//g" $newfile; #optional done # OTHER TASKS * cloning repo with all branches: git clone --mirror /.git cd git config --local --bool core.bare false git checkout master * cloning repo with a specific : git clone -b --single-branch # NOTES * use `git pull --rebase` instead of merging local commits to avoid excessive merges * merges should typically only happen when merging a distinct branch with master