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

finding if a commit is needed

From
Geoff Russell <geoffrey.russell@gmail.com>
Date
Jul 28, 2010, 08:53 UTC
Message-ID
<AANLkTin4o=uNBFELYMb8TDA=taGJyqpLvgxZcPFr+Pq+@mail.gmail.com>

We have an interface which "rolls back" commits to a previous time in a set of data files using read-tree.

Works great ... but sometimes there are files which have been changed in the working tree which cause read-tree to fail. The files should have been committed but weren't. "git read-tree -i" isn't appropriate because we want to commit these files before the read-tree rolls them back ... because they are changes which might be resurrected and we don't want to lose them altogether.

So ...
       git commit -a -m "something" && git read-tree ...
Doesn't work when there are no files which need committing ...
       git commit -a -m "something" || git read-tree ...
Doesn't work when there are.
Is there something which can test whether a commit is needed?

I define "needed" as meaning when git commit -a would make a non-identical commit.

Many thanks, Geoff.

Next: Jonathan Nieder
Message 1 of 3 in “finding if a commit is needed”
  1. Geoff RussellJul 28, 2010
  2. Jonathan NiederJul 29, 2010
  3. Geoff RussellJul 30, 2010

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.