Re: What's the best way to make my company migrate to Git?
- From
- Daniele Segato <daniele.bilug@gmail.com>
- Date
- Jun 1, 2010, 17:16 UTC
- Message-ID
- <AANLkTimnQJmctLU1LmT1x3KhB84J2Wrqsa8Nfo5vVDLI@mail.gmail.com>
- In-Reply-To
- <1533278916.20100601231415@yandex.ru>
2010/6/1 Alexander Iljin <ajsoft@yandex.ru>:
> Hello! > > DS> You also can't create new Subversion branches or tags with git-svn,
I've been corrected on this: git svn tag and git svn branch are there for that purpose.
> Another point: you can't contribute to branches via git-svn, you can > only commit to trunk. It is easy to be confused if you've created a > feature branch in Git. If you then want to git-svn dcommit a > half-done work, you will mess up the trunk.
that's not correct
You can contribute to any subversion branch, but you have to do it with a local branch tracking the remote one
say you are on "master" which track remote svn "trunk" and you want to contribute to remote branch "v1.x"
you can do this:
git checkout -b myBranch-v-1-x v1.x
it will checkout the remote v1.x creating a new label "myBranch-v-1-x" for tracking it. you can then work on myBranch-v-1-x as usual, when you'll git svn dcommit from there you'll commit on the remote v1.x branch.
but you have to be careful with cherry-picking.
if you want to cherry pick a comment on trunk to commit it on branch v1.x you'll have to amend it removing the line:
git-svn-id: https://your-svn-url/repos/trunk@1234 a123123....
or you'll not be able to commit on the remote v1.x branch.
I created a local alias for cherry-picking an a safe way for subversion:
[from alias section in my .gitconfig]
cherry-pick-svn = !GIT_EDITOR='sed -i /^git-svn-id:/d' git cherry-pick -e
which do a normal cherry-pick automatically editing the commit to remove that line.
may be this could be added to the svn alias list?
Regards, Daniele Segato