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

Re: [suggestion] Include commit-ish in git status output

From
Mahmoud Al-Qudsi <mqudsi@neosmart.net>
Date
Jun 16, 2017, 00:10 UTC
Message-ID
<CACcTrKdatvtqoMDiR5DR6cP_0gsqZnQDGbpq6vj6MU-+ABWF_w@mail.gmail.com>
In-Reply-To
<CAJZjrdW=1MbT=Lmouswez3W4hGP=anuMqMnQPkLta_fhUU4hCg@mail.gmail.com>
On Thu, Jun 15, 2017 at 6:55 PM, Samuel Lijin <sxlijin@gmail.com> wrote:
>
> Can you elaborate on why you consider this useful specifically?

Personally, primary usages of the current commit-ish info are to file bug reports that include the specific git revision of any given branch that a bug was observed in/on and to quickly note the currently checked-out revision prior to pulling the latest changes from an upstream server so that I can rollback without needing to tag/branch if needed.

But that's not really the reason why I emailed in with this suggestion. I think semantically the "status" of a working folder is perhaps best summed up as the sha1 of the commit (or its commit-ish, for short) plus the currently staged/unstaged changes to the checked out copy of that revision to indicate the _current_ status (there's that word again!) of the current git directory, combined with branch information to indicate where any staged changes would be committed to.

Currently, git shows two-thirds of the information needed to actually describe the actual working state (status) of a git directory (being the branch and staged/unchanged changes to HEAD), but does not describe what HEAD is in a stateless manner.

>
> Do you think adding a $(git rev-parse HEAD) to your PS1 would do the trick?

This is a bit more subjective, but my personal preference is to keep a minimal shell that retains its behavior regardless of whether I'm cd'd into a git repo or if I'm transcoding my music collection.

I have no problem needing to execute something to view the commit-ish when it is desired; this suggestion is merely focusing on what the something should be. I have no problem using `git rev-parse` for other tasks, but feel that needing a combination of `git status` and `git rev-parse HEAD` to accurately get a summary of the current state of a repo is perhaps much.

Thanks.
Previous: Samuel LijinNext: Junio C Hamano
Message 3 of 6 in “[suggestion] Include commit-ish in git status output”
  1. Mahmoud Al-QudsiJun 15, 2017
  2. Samuel LijinJun 15, 2017
  3. Mahmoud Al-QudsiJun 16, 2017
  4. Junio C HamanoJun 16, 2017
  5. Mahmoud Al-QudsiAug 7, 2017
  6. Junio C HamanoAug 7, 2017

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.