Git template

Just came by and stumbled on trying it out.
I like the idea and concept so far.


Sync GitHub fork with upstream master

As a GitHub newbie I had no clue how to sync my fork with upstream master repo. I had the following notice on my forked repo:

This branch is 35 commits behind
This branch is 35 commits behind

So after googling, the solution were some GIT commands:

More info at GitHub’s help page

I thought fork master will be auto-updated with upstream master.
Everyday I learn something new 🙂

Import Git repo with history log into Subversion repo

Many thanks to

When typing git svn init exclude /trunk at the end (I failed with this), because .git/config in the svn section defines the fetch path and appends the /trunk

[svn-remote "svn"]
        url = https://EXAMPLE.COM:PORT/svn/repo
        fetch = trunk:refs/remotes/origin/trunk
        branches = branches/*:refs/remotes/origin/*
        tags = tags/*:refs/remotes/origin/tags/*

So in my case this worked:

$ git svn init -s https://EXAMPLE.COM:PORT/svn/repo
$ git svn fetch
$ git log --pretty=oneline master | tail -n1
88464cfdf549a82b30ee7c52e53e2b310f0d9ec4 Initial commit

$ git show-ref trunk
741ab63aea786882eafd38dc74369e651f554c9c refs/remotes/trunk

$ echo "88464cfdf549a82b30ee7c52e53e2b310f0d9ec4 741ab63aea786882eafd38dc74369e651f554c9c" >> .git/info/grafts

Now if you check git log and scroll to the bottom you will see another entry under your ‘Initial commit’ (first commit), that’s from where SVN commit will merge it’s content from Git.

commit 29df3f4db3bcd7f590db2426a69760b0c971432a
Author: Michal Zuber 
Date:   Mon Jun 23 08:41:15 2014 +0200

    Initial commit

commit d3b17c72d666c463e1d4fb1e363319d20024106e
Author: VisualSVN Server 
Date:   Thu Feb 26 08:34:40 2015 +0000

    Initial structure.
    git-svn-id: 8ce696b1-2aa8-b049-9446-9fee1243c08b

Finally firing git svn dcommit

$ git svn dcommit
Committing to ...

Will push the Git stuff into Subversion repo.

To start fresh remove rm -rf .git/svn/ and [svn] section from .git/config which was added by git svn init