Re: Bug in git branch --show-current

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remember to reply-all on this list. Thanks.

On Tue, May 27, 2025, at 09:58, Ulrich Wittenberg wrote:
> Well, the commit hat I am sitting on was made on a branch. The question
> is: What ist he name oft he branch?

You say that this is a Jenkins job where it’s on detached HEAD.  Git
doesn’t record in the Git database itself what branch the user was on
when the commit was made (if any since you can commit on detached HEAD).
Unlike Mercurial (as I’ve heard, I haven’t used it), Git doesn’t store
that information.  A branch in Git points to a commit.

But the ephemeral reflog (git-reflog(1)) can record how a branch (and
HEAD) was updated.  From that you can find out what branch the user was
on when a commit was made.  But the reflog is local only.

But I wonder if you really need this information.  I’ve never had a need
for it.  Git is not designed in such a way that makes querying this
information simple.

> I tried your command and it also return nothing.
> All other commands also suddenly keep it Top Secret on what branch I am.
> Only an interactive "git log" shows it in the first line, but if you
> pipe that output into another command, this text also is suppressed.
>
> My next idea ist o dump the branch name (which the jenkins job knows)
> into a file and continue from there...

You might want to describe

• What commit Jenkins is on
• Where the branch or branches of interests point to
• How you expect branches to work





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux