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

Re: Some advanced index playing

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 3, 2006, 18:31 UTC
Message-ID
<ekv56m$vd0$1@sea.gmane.org>
In-Reply-To
<200612031701.15594.alan@chandlerfamily.org.uk>
Alan Chandler wrote:
Show 15 quoted lines
> 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.

I do wonder what this safety valve is for, and why it acts also if index version is equal to working directory version...

Show 7 quoted lines
> 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.
There is "git update-index --force-remove <that-file>". Currently there
is no "git reset -- <that-file>", but you can revert index entry to the
one in HEAD using
  $ git ls-tree HEAD -- <that-file> | git update-index --index-info
And you can always try "git-rm + git-add".
 
Show 6 quoted lines
> 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 

No, the command for that is just "git reset" (which means "git reset --mixed HEAD"), and touches HEAD and index but not working directory

> What happened to the text written here
> 
>   http://marc.theaimsgroup.com/?l=git&m=116406699903565&w=2
    "[DRAFT 2] Branching and merging with git"
> 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.

linux@horizon.com, perhaps you should send this text in the form of patch creating Documentation/tutorial-3.txt file?

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: Junio C HamanoNext: Linus Torvalds
Message 9 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.