git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Feature request: status could list ref names after "HEAD detached"
@ 2024-03-21  8:00 M Hickford
  2024-03-21 19:20 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: M Hickford @ 2024-03-21  8:00 UTC (permalink / raw)
  To: Git Mailing List

I frequently run `git status`. Sometimes HEAD is detached:

    HEAD detached at ea601b57e

It would be neat to include ref names here, similar to git log:

    HEAD detached at ea601b57e (origin/main, origin/HEAD, main)

This gives me more information before I create a new branch or switch branch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Feature request: status could list ref names after "HEAD detached"
  2024-03-21  8:00 Feature request: status could list ref names after "HEAD detached" M Hickford
@ 2024-03-21 19:20 ` Junio C Hamano
  2024-03-22 15:00   ` M Hickford
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2024-03-21 19:20 UTC (permalink / raw)
  To: M Hickford; +Cc: Git Mailing List

M Hickford <mirth.hickford@gmail.com> writes:

> I frequently run `git status`. Sometimes HEAD is detached:
>
>     HEAD detached at ea601b57e
>
> It would be neat to include ref names here, similar to git log:
>
>     HEAD detached at ea601b57e (origin/main, origin/HEAD, main)
>
> This gives me more information before I create a new branch or switch branch.

This has already moved away from the original "I want to know on
which branch other worktrees are working" feature, but while we are
expanding the edges...

I wonder what you want to see when a detached HEAD deviated from its
initial position (i.e., when we say "HEAD detached from", not "HEAD
detached at", in "git status" output).  Would we still want to show
the "--decorate" list of existing refs for the original position?

    $ git checkout --detach master
    $ git status | head -n1
    HEAD detached at 3bd955d269
    $ git checkout --allow-empty -m empty
    $ git status | head -n1
    HEAD detached from 3bd955d269
    $ git reset --hard HEAD^
    $ git status | head -n1
    HEAD detached at 3bd955d269

If we add "(master)" after 3bd955d269 in the above illustration, I
wonder if it makes it too misleading.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Feature request: status could list ref names after "HEAD detached"
  2024-03-21 19:20 ` Junio C Hamano
@ 2024-03-22 15:00   ` M Hickford
  0 siblings, 0 replies; 3+ messages in thread
From: M Hickford @ 2024-03-22 15:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: M Hickford, Git Mailing List

On Thu, 21 Mar 2024 at 19:20, Junio C Hamano <gitster@pobox.com> wrote:
>
> M Hickford <mirth.hickford@gmail.com> writes:
>
> > I frequently run `git status`. Sometimes HEAD is detached:
> >
> >     HEAD detached at ea601b57e
> >
> > It would be neat to include ref names here, similar to git log:
> >
> >     HEAD detached at ea601b57e (origin/main, origin/HEAD, main)
> >
> > This gives me more information before I create a new branch or switch branch.
>
> This has already moved away from the original "I want to know on
> which branch other worktrees are working" feature, but while we are
> expanding the edges...
>
> I wonder what you want to see when a detached HEAD deviated from its
> initial position (i.e., when we say "HEAD detached from", not "HEAD
> detached at", in "git status" output).  Would we still want to show
> the "--decorate" list of existing refs for the original position?
>
>     $ git checkout --detach master
>     $ git status | head -n1
>     HEAD detached at 3bd955d269
>     $ git checkout --allow-empty -m empty
>     $ git status | head -n1
>     HEAD detached from 3bd955d269
>     $ git reset --hard HEAD^
>     $ git status | head -n1
>     HEAD detached at 3bd955d269
>
> If we add "(master)" after 3bd955d269 in the above illustration, I
> wonder if it makes it too misleading.

Interesting. I hadn't appreciated the difference between "HEAD
detached at" and "HEAD detached from". In the 'from' case, it'd be
informative to see some measure of distance from the original
position:

HEAD detached from 3bd955d269 (HEAD~1)
HEAD detached [ahead 1] from 3bd955d269

Decorated with refs:

HEAD detached from 3bd955d269 (HEAD~1, master)
HEAD detached [ahead 1] from 3bd955d269 (master)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-22 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-21  8:00 Feature request: status could list ref names after "HEAD detached" M Hickford
2024-03-21 19:20 ` Junio C Hamano
2024-03-22 15:00   ` M Hickford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).