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

Re: Separating "add path to index" from "update content in index"

From
Shawn Pearce <spearce@spearce.org>
Date
Dec 22, 2006, 05:21 UTC
Message-ID
<20061222052156.GA15548@spearce.org>
In-Reply-To
<7vfyb87bxg.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 5 quoted lines
> And it is not just limited to adding the contents of a path that
> happened to be told git for the first time.  Adding the contents
> of a path that was known to git also happens only when it is in
> a presentable good state.  So running "git diff" and not seeing
> what I added before is a GOOD THING.
Yes!

Sadly it has taken me 12 months of working with Git to get comfortable enough with that concept.

Actually it clicked once I realized that 'update-index' was actually creating the blobs in the ODB and not 'write-tree'. Prior to that "click" going off in my grey matter I always felt that Git screwed up when I did:

	$ vi foo.c
	$ git update-index foo.c
	$ git diff
	# what the ? where are my changes?

I now make quite heavy use of the index even when hacking on code, and not just during merges. But I wasn't like that just 5 months ago...

-- 
Shawn.
Previous: Junio C HamanoNext: Jakub Narebski
Message 17 of 22 in “GIT - error: no such remote ref refs/heads/TestBranch”
  1. Sean KelleyDec 19, 2006
  2. Junio C HamanoDec 19, 2006
  3. Carl WorthDec 20, 2006
  4. Junio C HamanoDec 20, 2006
  5. Carl WorthDec 20, 2006
  6. Junio C HamanoDec 20, 2006
  7. Carl WorthDec 21, 2006
  8. Peter BaumannDec 21, 2006
  9. Junio C HamanoDec 22, 2006
  10. Separating "add path to index" from "update content in index"Carl Worth, Dec 22, 2006
  11. SeanDec 22, 2006
  12. Nicolas PitreDec 22, 2006
  13. Carl WorthDec 22, 2006
  14. Nicolas PitreDec 23, 2006
  15. Daniel BarkalowDec 24, 2006
  16. Junio C HamanoDec 22, 2006
  17. Shawn PearceDec 22, 2006
  18. Jakub NarebskiDec 22, 2006
  19. Carl WorthDec 22, 2006
  20. Nicolas PitreDec 22, 2006
  21. Carl WorthDec 22, 2006
  22. Daniel BarkalowDec 23, 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.