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

Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-) [Scanned]

From
Boyd Stephen Smith Jr. <bss@iguanasuicide.net>
Date
Dec 30, 2008, 23:31 UTC
Message-ID
<200812301731.40572.bss@iguanasuicide.net>
In-Reply-To
<BB5F02FD3789B54E8964D38D6775E718242D31@ALTMORE-SVR.altmore.local>
On Tuesday 2008 December 30 16:36:19 Conor Rafferty wrote:
> I don't understand, sorry. I thought I'd already removed all files from
> the local tree, in the $ rm *.* move just above the checkout

Yeah, I guess I missed that, and I am seeing some "odd" behavior from git checkout <treeish> <path>, but I'm not an expert on exactly what that is supposed to do, particularly when applied to a directory.

The description is: "When <paths> are given, this command does not switch branches. It updates the named paths in the working tree from the index file, or from a named commit. [...] <tree-ish> argument can be used to specify a specific tree-ish to update the index for the given paths before updating the working tree."

I'm guess what is happening here is that the index is getting updated in a way that includes both the files from the HEAD tree and from the named tree. Then the modified index is written out, outputting all of them, effectively doing some sort of "theirs" merge. It's not quite what I would expect but I don't normally use git checkout <treeish> <path> when path indicates a directory.

You should do a "git status" when you get ls output that is "unexpected". Here, it confirms that the index has been updated (git thinks I've staged some changes).

Personally, I expected "git checkout <treeish> <paths>" to bypass the index entirely, the way "git commit <paths>" does, but this way also makes sense -- at least when applied to a single file. (And probably saves a good number of git add commands...).

In short, while I can't say for sure, I'm pretty sure you don't want the "git commit <treeish> <path>" form and want the "git commit <treeish>" form instead.

-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@iguanasuicide.net                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     
Previous: Conor RaffertyNext: Daniel Barkalow
Message 2 of 4 in “RE: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-) [Scanned]”
  1. Conor RaffertyDec 30, 2008
  2. Boyd Stephen Smith Jr.Dec 30, 2008
  3. Daniel BarkalowDec 31, 2008
  4. Jeff WhitesideDec 31, 2008

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.