Tag Archives: git

Migration Mercurial to git

Migration mercurial to git

Clone the old repo

hg clone http://safematix.com/hg mercurial-repo

create a file name my-filemap with

exclude path/to/.git

Convert the old repo to a new Mercurial repo without git folders

hg convert --filemap my-filemap mercurial-repo/ new_mercurial-repo

create the new git repo

mkdir git
cd git
git init

Convert the Mercurial to git

/usr/bin/hg-fast-export -r ../new_mercurial-repo

Check the new git repo

git fsck

If all is okay

git checkout HEAD
git remote add origin git@safematix.com:GROUP/PROJECT.git
git push -u origin master

Migrate git repository to new server

Migrate git repository to new server

Clone the old repo

 git clone git@OLD_SERVER:GROUP/PROJECT.git

Look for the remote server in you repo

git remote -v
origin git@OLD_SERVER:GROUP/PROJECT.git (fetch)
origin git@OLD_SERVER:GROUP/PROJECT.git (push)

Remove the old server from list

git remote rm origin

Add new server and push the repo

git remote add origin git@NEW_SERVER:GROUP/PROJECT.git
git push -u origin master

If you like to copy the tags

git push origin --tags -f