{"thread":{"id":"61170","subject":"Feature request: status could list ref names after \"HEAD detached\"","startedAt":"2024-03-21T08:01:39Z","lastAt":"2024-03-22T15:00:38Z","messageCount":3,"participants":["M Hickford","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"491112","messageId":"CAGJzqs=ULaHwttY1jRaW4ZT0tGeSW2S_gcEw=tMrY+i26Jy1gA@mail.gmail.com","threadId":"61170","inReplyTo":null,"subject":"Feature request: status could list ref names after \"HEAD detached\"","fromName":"M Hickford","fromEmail":"mirth.hickford@gmail.com","sentAt":"2024-03-21T08:00:00Z","receivedAt":"2024-03-21T08:01:39Z","isPatch":false,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"I frequently run `git status`. Sometimes HEAD is detached:\n\n    HEAD detached at ea601b57e\n\nIt would be neat to include ref names here, similar to git log:\n\n    HEAD detached at ea601b57e (origin/main, origin/HEAD, main)\n\nThis gives me more information before I create a new branch or switch branch.\n"},{"id":"491165","messageId":"xmqq5xxf8k9r.fsf@gitster.g","threadId":"61170","inReplyTo":"CAGJzqs=ULaHwttY1jRaW4ZT0tGeSW2S_gcEw=tMrY+i26Jy1gA@mail.gmail.com","subject":"Re: Feature request: status could list ref names after \"HEAD detached\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-03-21T19:20:00Z","receivedAt":"2024-03-21T19:20:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"M Hickford <mirth.hickford@gmail.com> writes:\n\n> I frequently run `git status`. Sometimes HEAD is detached:\n>\n>     HEAD detached at ea601b57e\n>\n> It would be neat to include ref names here, similar to git log:\n>\n>     HEAD detached at ea601b57e (origin/main, origin/HEAD, main)\n>\n> This gives me more information before I create a new branch or switch branch.\n\nThis has already moved away from the original \"I want to know on\nwhich branch other worktrees are working\" feature, but while we are\nexpanding the edges...\n\nI wonder what you want to see when a detached HEAD deviated from its\ninitial position (i.e., when we say \"HEAD detached from\", not \"HEAD\ndetached at\", in \"git status\" output).  Would we still want to show\nthe \"--decorate\" list of existing refs for the original position?\n\n    $ git checkout --detach master\n    $ git status | head -n1\n    HEAD detached at 3bd955d269\n    $ git checkout --allow-empty -m empty\n    $ git status | head -n1\n    HEAD detached from 3bd955d269\n    $ git reset --hard HEAD^\n    $ git status | head -n1\n    HEAD detached at 3bd955d269\n\nIf we add \"(master)\" after 3bd955d269 in the above illustration, I\nwonder if it makes it too misleading.\n"},{"id":"491247","messageId":"CAGJzqskywQhaaG+HPWiLDqtrUE3+Zb0XuGdheJaHJMS7LqJ9xA@mail.gmail.com","threadId":"61170","inReplyTo":"xmqq5xxf8k9r.fsf@gitster.g","subject":"Re: Feature request: status could list ref names after \"HEAD detached\"","fromName":"M Hickford","fromEmail":"mirth.hickford@gmail.com","sentAt":"2024-03-22T15:00:00Z","receivedAt":"2024-03-22T15:00:38Z","isPatch":false,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"On Thu, 21 Mar 2024 at 19:20, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> M Hickford <mirth.hickford@gmail.com> writes:\n>\n> > I frequently run `git status`. Sometimes HEAD is detached:\n> >\n> >     HEAD detached at ea601b57e\n> >\n> > It would be neat to include ref names here, similar to git log:\n> >\n> >     HEAD detached at ea601b57e (origin/main, origin/HEAD, main)\n> >\n> > This gives me more information before I create a new branch or switch branch.\n>\n> This has already moved away from the original \"I want to know on\n> which branch other worktrees are working\" feature, but while we are\n> expanding the edges...\n>\n> I wonder what you want to see when a detached HEAD deviated from its\n> initial position (i.e., when we say \"HEAD detached from\", not \"HEAD\n> detached at\", in \"git status\" output).  Would we still want to show\n> the \"--decorate\" list of existing refs for the original position?\n>\n>     $ git checkout --detach master\n>     $ git status | head -n1\n>     HEAD detached at 3bd955d269\n>     $ git checkout --allow-empty -m empty\n>     $ git status | head -n1\n>     HEAD detached from 3bd955d269\n>     $ git reset --hard HEAD^\n>     $ git status | head -n1\n>     HEAD detached at 3bd955d269\n>\n> If we add \"(master)\" after 3bd955d269 in the above illustration, I\n> wonder if it makes it too misleading.\n\nInteresting. I hadn't appreciated the difference between \"HEAD\ndetached at\" and \"HEAD detached from\". In the 'from' case, it'd be\ninformative to see some measure of distance from the original\nposition:\n\nHEAD detached from 3bd955d269 (HEAD~1)\nHEAD detached [ahead 1] from 3bd955d269\n\nDecorated with refs:\n\nHEAD detached from 3bd955d269 (HEAD~1, master)\nHEAD detached [ahead 1] from 3bd955d269 (master)\n"}]}