I am using "git svn" to interact with a large SVN repo with non-standard branching convention. I see that there are multiple ways to clone the svn repo / branches as pointed out here
I am seeing really different behaviors:
Say the SVN repo is as follows:
http://svn.mycom.com/svn/Project
-->trunk
-->defects
-->uat
Production is in "trunk", branches are in "defects", current development is in "uat".
So that being said I could do the following
1. clone direct uat..
$ git svn clone http://svn.mycom.com/svn/Project/uat
when I do this my .git/config file looks like:
[svn-remote "svn"]
url = http://svn.mycom.com/svn/Project/uat
fetch = :refs/remotes/trunk
I then added branches as described here My .git/config looks similar to:
[svn-remote "svn"]
url = http://svn.mycom.com/svn/Project/uat
fetch = :refs/remotes/trunk
[svn-remote "task1"]
url = http://svn.mycom.com/svn/Project/defects/task1
fetch = :refs/remotes/task1
Now when I run
$git log --decorate --all --graph
I see that my new branch has only 1 commit, ie. branch creation it does not relate to the actual history to master. it shows its own history line without any connection to prior commits.
2. Clone with -T then adding branches Alternative solution I found was:
$git svn clone http://svn.mycom.com/svn/Project/ -T uat Project --no-minimize-url
Since the "Defects" has lot many branches, and it would take hours, i then did:
[svn-remote "svn"]
url = http://svn.mycom.com/svn/Project
fetch = uat:refs/remotes/trunk
branches = defects/{task1}:refs/branches/*
This seems to work nice and I do get the history. I am wondering what is the better way of the two, if there is anything I need to think about going from one vs the other option. In this option though, if I have to add another branch, I cannot simply edit the branches section and new branch name in the comma separated list like branches = defects/{task1,task2}. This does not work feels like a GIT defect. I then just add another fetch line below the branches
[svn-remote "svn"]
url = http://svn.mycom.com/svn/Project
fetch = uat:refs/remotes/trunk
branches = defects/{task1}:refs/branches/*
fetch = defects/task2:refs/branches/task2
This works fine, i get the branch history and able to switch w/o issues. but just feels like a hack. I wish there was a way to just append it to branches list which would look clean.