git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-svn, and which branch am I on?

From
PHPeter Harris <git@peter.is-a-geek.org>
Date
Feb 28, 2009, 15:03 UTC
Message-ID
<eaa105840902280703w3dcc9b7fv9095ba874624dcca@mail.gmail.com>
In-Reply-To
<87ljrr7xof.fsf@rimspace.net>
On Sat, Feb 28, 2009 at 3:50 AM, Daniel Pittman wrote:
>
> The general question was: in git, how do I identify where this branch
> came from?
> Specifically, this was about 'git svn', but also generally how to
> identify this information in git.
> ...and, finally, is the reason that I am finding it hard to explain this
> because I have an expectation of how things work that doesn't match up
> with git?  In other words, is the question actually meaningless?

You've hit the nail on the head. The question is meaningless. Git tracks a DAG, and a branch is just that - a branch (or 'tip', if you will) of the DAG.

Take, for example,
o--o--o--o master
 \
  o--o--o--o feature
      \
       o--o working

Which branch did 'working' come from? 'feature' or 'master'? Say I later delete branch 'feature', since it was going in the wrong direction. Does the answer change? What if I simply redraw the above so that feature and working are swapped? Does the answer change? It's still the same tree.

You can, however, answer related questions.

'git svn info' will tell you which branch a 'git svn dcommit' will commit to, which is usually the question you actually wanted to answer.

'git branch -r' will tell you which remote branch your local branch is tracking. ie. which branch, if any, a plain 'git pull' will fetch and merge from.

See also http://thread.gmane.org/gmane.comp.version-control.git/77730/focus=77823 and surrounding thread.

Peter Harris
Previous: Björn SteinbrinkNext: Jakub Narebski
Message 3 of 4 in “git-svn, and which branch am I on?”
  1. Daniel PittmanFeb 28, 2009
  2. Björn SteinbrinkFeb 28, 2009
  3. Peter HarrisFeb 28, 2009
  4. Jakub NarebskiFeb 28, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.