[petsc-dev] get rid of https://bitbucket.org/petsc/petsc-dev NOW

Satish Balay balay at mcs.anl.gov
Thu Sep 4 22:25:36 CDT 2014


On Thu, 4 Sep 2014, Jed Brown wrote:

> Satish Balay <balay at mcs.anl.gov> writes:
> > How do I get a branch name? I would assume 'git branch' would give
> > this info - but it does not [it gives a big list]
> >
> > http://stackoverflow.com/questions/6245570/how-to-get-current-branch-name-in-git
> > has too many options - most are not suitable..
> >
> > git branch | sed -n '/\* /s///p'
> 
> What's wrong with "git rev-parse --abbrev-ref HEAD" or "git symbolic-ref HEAD"?

balay at asterix /home/balay/petsc (maint)
$ git checkout origin/master

<snip>

balay at asterix /home/balay/petsc ((de1529e...))
$ git branch | sed -n '/\* /s///p'
(detached from origin/master)
balay at asterix /home/balay/petsc ((de1529e...))
$ git rev-parse --abbrev-ref HEAD
HEAD
balay at asterix /home/balay/petsc ((de1529e...))
$ git symbolic-ref HEAD
fatal: ref HEAD is not a symbolic ref
balay at asterix /home/balay/petsc ((de1529e...))

Notice the first one has useful info - but not the others. Even
git-prompt gives some useful info [if not the the branch name..]

So I pushed a change using 'git branch' and parsing its output
from python [instead of 'sed']

I'm suprised 'git branch' doesnt do the most obvious thing that one
would expect. [default to - or have an option to list the current
branch - not all the branches]

Satish



More information about the petsc-dev mailing list