{"thread":{"id":"10197","subject":"bug? - git-checkout treeish paths ignores deleted files","startedAt":"2007-10-09T00:58:06Z","lastAt":"2007-10-09T10:20:48Z","messageCount":4,"participants":["Mark Levedahl","Wincent Colaiuta"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"55217","messageId":"470AD21E.6070906@gmail.com","threadId":"10197","inReplyTo":null,"subject":"bug? - git-checkout treeish paths ignores deleted files","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2007-10-09T00:58:06Z","receivedAt":"2007-10-09T00:58:06Z","isPatch":false,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"Shouldn't   \"git checkout topic path\"  make the directory tree rooted at \npath identical to what is on branch topic? It doesn't.\n\nTry this:\n\nmkdir test\ncd test\ngit init\ntouch a b\ngit add a b\ngit commit -m 'base'\ngit checkout -b topic\ngit rm a\ngit commit -m 'removed a'\ngit checkout master\ngit checkout topic .\n\n...and the result is...\nls\na   b\n\ninstead of\nb\n\nMark\n"},{"id":"55219","messageId":"3B0685AB-0725-4473-8AE6-359F93851C10@wincent.com","threadId":"10197","inReplyTo":"470AD21E.6070906@gmail.com","subject":"Re: bug? - git-checkout treeish paths ignores deleted files","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2007-10-09T01:52:15Z","receivedAt":"2007-10-09T01:52:15Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 9/10/2007, a las 2:58, Mark Levedahl escribió:\n\n> Shouldn't   \"git checkout topic path\"  make the directory tree  \n> rooted at path identical to what is on branch topic? It doesn't.\n>\n> Try this:\n>\n> mkdir test\n> cd test\n> git init\n> touch a b\n> git add a b\n> git commit -m 'base'\n> git checkout -b topic\n> git rm a\n> git commit -m 'removed a'\n> git checkout master\n> git checkout topic .\n>\n> ...and the result is...\n> ls\n> a   b\n>\n> instead of\n> b\n\nNo, the behaviour is correct.\n\n- first you removed the file on the topic branch; at the same time  \nyou removed it from your working tree\n- then you switched back to the master branch and so the file was  \nadded back to your working tree\n- then you switched back to the topic branch, and seeing as the file  \n\"a\" is not being tracked in the topic branch Git doesn't touch it\n\nIn general, Git only meddles with stuff that you've told it to track.  \nThis is actually a good thing in most cases because it makes some  \nworkflows involving dirty trees or trees with untracked content  \nsomewhat more convenient.\n\nCheers,\nWincent\n"},{"id":"55220","messageId":"470AF7F1.2010903@gmail.com","threadId":"10197","inReplyTo":"3B0685AB-0725-4473-8AE6-359F93851C10@wincent.com","subject":"Re: bug? - git-checkout treeish paths ignores deleted files","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2007-10-09T03:39:29Z","receivedAt":"2007-10-09T03:39:29Z","isPatch":false,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"Wincent Colaiuta wrote:\n> El 9/10/2007, a las 2:58, Mark Levedahl escribió:\n>\n>> Shouldn't   \"git checkout topic path\"  make the directory tree rooted \n>> at path identical to what is on branch topic? It doesn't.\n>>\n>>\n>\n> No, the behaviour is correct.\n>\n> - first you removed the file on the topic branch; at the same time you \n> removed it from your working tree\n> - then you switched back to the master branch and so the file was \n> added back to your working tree\n> - then you switched back to the topic branch, and seeing as the file \n> \"a\" is not being tracked in the topic branch Git doesn't touch it\n>\n> In general, Git only meddles with stuff that you've told it to track. \n> This is actually a good thing in most cases because it makes some \n> workflows involving dirty trees or trees with untracked content \n> somewhat more convenient.\n>\n> Cheers,\n> Wincent\n>\n>\nI'm not convinced...\n\n\"git checkout branch dir\" should make dir have the same value it would \nget if I just did \"git checkout branch\".  The latter command will ignore \nfiles only if they are untracked in *both* HEAD and branch. I fail to \nsee why the path-limited version of git-checkout should give a different \nresult on the part it is asked to affect than the non-path limited \nversion. This is very inconsistent and I'm having a hard time \nunderstanding what workflow it will help.\n\nMark\n"},{"id":"55249","messageId":"766E760C-D3F3-4593-BA95-D547CCAD0E29@wincent.com","threadId":"10197","inReplyTo":"470AF7F1.2010903@gmail.com","subject":"Re: bug? - git-checkout treeish paths ignores deleted files","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2007-10-09T10:20:48Z","receivedAt":"2007-10-09T10:20:48Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 9/10/2007, a las 5:39, Mark Levedahl escribió:\n\n> I'm not convinced...\n>\n> \"git checkout branch dir\" should make dir have the same value it  \n> would get if I just did \"git checkout branch\".  The latter command  \n> will ignore files only if they are untracked in *both* HEAD and  \n> branch. I fail to see why the path-limited version of git-checkout  \n> should give a different result on the part it is asked to affect  \n> than the non-path limited version. This is very inconsistent and  \n> I'm having a hard time understanding what workflow it will help.\n\nI don't know the historical reasons for the difference but it's  \nexplained in the second para of the man page:\n\n    When <paths> are given, this command does not switch branches. It\n    updates the named paths in the working tree from the index file  \n(i.e.\n    it runs git-checkout-index -f -u), or from a named commit.\n\nSo when you supply \".\" as a path it's not actually switching  \nbranches. So that's why you see the different behaviour; it's  \nintentionally different. Like I said, I don't know the reasons why  \nbut I imagine it's to make it easy to grab specific files from other  \nbranches without actually switching.\n\nCheers,\nWincent\n"}]}