[clug] Git help please - I might be breaking branches
Daniel Pittman
daniel at rimspace.net
Mon Mar 23 02:49:14 GMT 2009
Alex Satrapa <grail at goldweb.com.au> writes:
> Working on tickets in Trac, I've been doing this:
>
>> # Have you ever danced with Subversion by the pale moonlight?
>> git svn fetch
>> git svn rebase
That will fetch changes automatically, but only for the current branch
parent in SVN, so you probably want to either omit the fetch, or use
'git svn rebase --local' to avoid extra network overhead.
[...]
>> # At this point I have the repositories in sync again, the ticket
>> # in Trac was closed during the post-commit hooks on Subversion,
>> # and the world is happy... almost:
>>
>> git branch
>>
>> svn-trunk
>> ticket-1
>> ticket-2
>> ticket-3
>> ...
>> ticket-123
>
> When I try to delete the branch, I get this:
>
>> [alex at here]# git branch -d ticket-123
>> error: The branch 'ticket-123' is not an ancestor of your current HEAD.
>> If you are sure you want to delete it, run 'git branch -D ticket-119'.
>
> Now while I'm sure that I want to delete ticket-123, and I'm
> absolutely certain that the changes incurred by ticket-123 have been
> merged into svn-trunk and are working ... what have I done (or not
> done) that is causing git to freak out?
It wants to make sure you are doing the right thing by deleting a random
branch, rather than one related to where you are working.
Just use '-D' to make it happy, since 'git svn' branches are not merged
using 'git merge', but rather through 'git svn fetch' and 'git svn
rebase', which don't act like normal git operations.
[...]
> Or is it safe to "-D" delete the branch and hope that everything just
> works like I expect it to? I want to keep the history around, I just
> don't want my list of branches to grow infinitely.
Yes, it is both safe and the recommend 'git svn' practice to work in
this way: the upstream author recommends using dcommit and rebase to
merge upstream changes rather than git merge.
This is the logical fallout from that, where there is a slight mismatch
between the git branch model, the svn branch model and the git svn
branch model.
Regards,
Daniel
More information about the linux
mailing list