Tag Archives: git

Migrate svn to git repo from a local svn reposiroty

This is a how to migrate a svn repository or repository folder to git when you have full control on the svn repository.

  • I started to create a directory where I’ll do the job, (you can do the work where your current repo is located. you need svn and git to be installed on the machine)

mkdir C:\Temp\svn_migration

  • copy your repo in there, you should have something like this


  • create a authors.txt file in the conf folder, copy the user from the passwd file

the structure of passwd file is sthg like

user = password

create a new authors.txt file in C:\Temp\svn_migration and use this layout. only the left hand side of the equal is relevant for us. (for the example above : user)

user = aName aLastName <auser@example.com>

  • start svnserve : from a cmd prompt, start the svnserve.exe for your repo. svnserve comes with subversion installation, but also with tortoisesvn.

"C:\Program Files (x86)\Subversion\bin\svnserve.exe" -d -R --root C:/Temp/svn_migration/svn_repository

  • start the migration. just issue the following command in C:\Temp\svn_migration

git svn clone svn://localhost/path/to/your/repo --no-minimize-url --no-metadata -A authors.txt someFolderName

note : The --no-minimize-url makes sure that git svn only clones the specific directory without trying to clone the root of the repository.

  • add a remote and push : finally you want to share it with other so:

cd to your git repo C:/Temp/svn_migration/someFolderName then

git remote add origin https://yourRemotegiturl

git push --set-upstream origin master





once upon Git commands

Shortcuts to some usefull Git commands used in day to day work

//create a branch
git branch <branch_name>

//set us currently on a specific branch
git checkout <branch_name>

//shortcut for all that
git checkout -b <branch_name>

//push branch to origin 
git push -u origin <branch_name>

//delete local branch
git branch -d <branch_name>

//delete branch remotely
git push origin --delete <branch_name>
git push origin :<branch_name>

when a fix has been done on the master branch and you want the changes from that master in your branch. The best approach, in my opinion. after you done all commit in your local “feature, fix…” branch locally (and remotely)

master     : ---A---B---C--------G
                         \        \
branch-bis :              \        H--I---J---K ....
                           \         /
branch     :                D---E---F

//1. set ourselves in the master branch and pull changes locally
git checkout master
git pull

//2. create a new branch locally and optionally remotely
git checkout -b <branch_name_bis>
git push -u origin <branch_name_bis>

//3. merge changes from the original branch we want 
// the master changes merge to,
// and optionaly delete it locally and remotely
git merge <branch_name>
git branch -d <branch_name>
git push origin :<branch_name>