carnicer
carnicer

Reputation: 523

where is git-svn's git-svn TAG?

I am using git-svn in order to practice with git. I mean I am by no means a git expert. In the beginning I found git daunting but I am getting fascinated by git's design and power. I have a question I could not answer searching on internet, perhaps because it is difficult to search for.

After some days of development on a feature branch using git (after cloning with git-svn), I want to rebase the commits before I git svn dcommit. I do not want to flood the svn integration branch with dozens of small, meaningless commits. For that I know I can use git rebase -i.

This command needs to have a commit specified. I have read I can use a (tag?) called git-svn. Indeed, such a commit/tag exists, I can git log git-svn.., or git rebase -i git-svn.

So far so good, this works. Now, after this introduction, my question:

What is this git-svn reference? A tag? A commit? Command git tag --list shows nothing, and git-svn as a tag does not exist on the other git clones I have used to work.

Another question: After I git svn dcommit, will that reference be changed? Can it be changed manually?

Thanks.

Upvotes: 1

Views: 201

Answers (2)

sleske
sleske

Reputation: 83599

In this case, git-svn is not a tag. It is a (special kind of) remote-tracking branch created by git svn clone.

Background:

When you clone an SVN repository using git svn clone, by default the whole repo will be cloned as one remote-tracking git branch (to convert SVN branches to git branches, you must use the the options -T, -b, -s; see section Handling of SVN branches of the manpage). In that case, git svn will create that remote-tracking branch as "refs/remotes/git-svn".

Now git allows you to abbreviate references to branches; so instead of writing git log refs/heads/master, you can write git log master. Similarly, "refs/remotes/git-svn" can be abbreviated as "git-svn". This is explained in the manpage gitrevisions.

So to answer your questions:

What is this git-svn reference? A tag? A commit?

It is a remote-tracking branch. It is shown by git branch -a.

Another question: After I git svn dcommit, will that reference be changed?

Yes. The branch "git-svn" tracks the SVN repo you cloned, so it will be changed whenever you fetch new revisions from SVN; this includes calling git svn dcommit and git svn fetch.

Can it be changed manually?

Yes, it can, just like any other git branch. However, in general this is pointless; it will only confuse git svn and mess up your repository. There are situations where it is necessary (for example to re-fetch SVN revisions that changed on the server), but that is a different question...

Upvotes: 2

Alessandro
Alessandro

Reputation: 740

I use extensively git-svn for my projects and I can't find a reference named git-svn. Which git version are you using?

From my own experience, git-svn creates a reference named trunk that points to the last commit retrieved form the svn server. When you perform a git svn dcommit or a git svn rebase the reference is updated to the commit representing the HEAD revision of svn repo.

In order to perform the dcommit you describe, you can:

git svn rebase (to update your current branch to the latest svn revision)
git rebase -i trunk (to rewrite local history before dcommit-ting)
git svn dcommit 

After the last step the trunk reference will be updated to the svn revision just commited.

Upvotes: 0

Related Questions