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

Best way to check whether working tree matches a commit's tree

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Aug 22, 2017, 18:00 UTC
Message-ID
<onhres$g9$1@blaine.gmane.org>
Hi,
I'd like to check whether my working tree exactly matches the tree of a given commit. That is, there should not be any untracked, staged or modified files (including ignored files).
Currently, I'm doing this in two steps:
- check for success and empty output of "git status --ignored --porcelain"
- check that the output of "git rev-parse HEAD" matches the given commit
While this works, it feels sub-optimal. Is there a better / smarter way?
-- 
Sebastian Schuberth
Next: Junio C Hamano
Message 1 of 3 in “Best way to check whether working tree matches a commit's tree”
  1. Sebastian SchuberthAug 22, 2017
  2. Junio C HamanoAug 22, 2017
  3. Sebastian SchuberthAug 22, 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.