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

Some advanced index playing

From
Alan Chandler <alan@chandlerfamily.org.uk>
Date
Dec 3, 2006, 17:01 UTC
Message-ID
<200612031701.15594.alan@chandlerfamily.org.uk>

With all the discussion about the index file in the last few days I would have thought that this issue would have come up. But I don't think it has.

I have been editing a set of files to make a commit, and after editing each one had done a git update-index.

At this point I am just about to commit when I realise that one of the files has changes in it that really ought to be a separate commit.

So effectively, I want to do one of three things
a) git-commit <that-file>

Except I can't because there is a safety valve that prevents this and there is no force option.

b) Revert the index entry for that file back to the previous HEAD commit point, whilst leaving the edits in the working tree, so that I can then commit without that one file.

I can't find a command to do that. The nearest seems to be git-update-index --remove, but the manual says that it will not do anything if the file still exists.

c) Revert the entire index back to the state it was at the last commit so I can selectively add back in the files that I have editted.

The command to do that seems to be
git-read-tree HEAD 

I tried this, and it did indeed seem to exactly this - not quite what I wanted, but actually a reasonable compromise.

However, it took me a long time scanning possible commands before I found it so I thought I might add some text to one of the tutorials

Any ideas of where?
What happened to the text written here
http://marc.theaimsgroup.com/?l=git&m=116406699903565&w=2

I thought this might be a place to put something like this, but having just updated my version of git from source, it doesn't seem to have been put in to git anywhere yet.

-- 
Alan Chandler
Next: Linus Torvalds
Message 1 of 21 in “Some advanced index playing”
  1. Alan ChandlerDec 3, 2006
  2. Linus TorvaldsDec 3, 2006
  3. Junio C HamanoDec 3, 2006
  4. Alan ChandlerDec 3, 2006
  5. Jakub NarebskiDec 3, 2006
  6. Alan ChandlerDec 3, 2006
  7. Linus TorvaldsDec 3, 2006
  8. Junio C HamanoDec 4, 2006
  9. Jakub NarebskiDec 3, 2006
  10. Linus TorvaldsDec 3, 2006
  11. Junio C HamanoDec 3, 2006
  12. git-explainJunio C Hamano, Dec 5, 2006
  13. Jakub NarebskiDec 5, 2006
  14. Martin LanghoffDec 5, 2006
  15. Junio C HamanoDec 5, 2006
  16. Johannes SchindelinDec 5, 2006
  17. Junio C HamanoDec 5, 2006
  18. Carl WorthDec 6, 2006
  19. Johannes SchindelinDec 6, 2006
  20. Nicolas PitreDec 6, 2006
  21. Alan ChandlerDec 3, 2006

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.