{"thread":{"id":"20834","subject":"Deleted folder keeps showing up?","startedAt":"2009-09-03T16:59:18Z","lastAt":"2009-09-07T08:17:05Z","messageCount":6,"participants":["Benjamin Buch","Michael J Gruber","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"122364","messageId":"34230C98-81B8-4DC8-846F-8B6FA2A022DA@gmx.de","threadId":"20834","inReplyTo":null,"subject":"Deleted folder keeps showing up?","fromName":"Benjamin Buch","fromEmail":"benni.buch@gmx.de","sentAt":"2009-09-03T16:59:18Z","receivedAt":"2009-09-03T16:59:18Z","isPatch":false,"sender":{"key":"benni.buch@gmx.de","avatar":"https://gravatar.com/avatar/76977471fc2129a2866767588b6699227cc6e16cd2c4603837873d81529bff01?d=mp&s=160"},"body":"I made a branch and deleted a folder there with git rm -rf foldername.\nSo now i have to branches, A with the folder and B without the folder.\n\nI'm on B, the folder is not there.\nThen I check out A, the folder shows up like it should.\nWhen I check out B again, the folder is still there.\n\nA git rm -rf folder gives me:\n\n\tfatal: pathspec 'folder/' did not match any files\n\n, so git is not tracking the folder.\n\nI can rm -rf the filder without git and start the whole game from the  \nbeginning,\nbut there has to be a better way?\n\nStrange enough this happens just to two folders I removed,\nwith others there is no problem.\n\n-benjamin\n  \n"},{"id":"122394","messageId":"4AA0C4A2.5040405@drmicha.warpmail.net","threadId":"20834","inReplyTo":"34230C98-81B8-4DC8-846F-8B6FA2A022DA@gmx.de","subject":"Re: Deleted folder keeps showing up?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-09-04T07:41:22Z","receivedAt":"2009-09-04T07:41:22Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Benjamin Buch venit, vidit, dixit 03.09.2009 18:59:\n> I made a branch and deleted a folder there with git rm -rf foldername.\n> So now i have to branches, A with the folder and B without the folder.\n> \n> I'm on B, the folder is not there.\n> Then I check out A, the folder shows up like it should.\n> When I check out B again, the folder is still there.\n> \n> A git rm -rf folder gives me:\n> \n> \tfatal: pathspec 'folder/' did not match any files\n> \n> , so git is not tracking the folder.\n> \n> I can rm -rf the filder without git and start the whole game from the  \n> beginning,\n> but there has to be a better way?\n> \n> Strange enough this happens just to two folders I removed,\n> with others there is no problem.\n\nWhat does \"git status\" say when you've checked out B? Could some\ncontents of folder/ possibly be being ignored (.git/info/excludes etc.)?\n\nMichael\n"},{"id":"122395","messageId":"8E56979B-5D85-4844-A492-8149EE9E9B2F@gmx.de","threadId":"20834","inReplyTo":"4AA0C4A2.5040405@drmicha.warpmail.net","subject":"Re: Deleted folder keeps showing up?","fromName":"Benjamin Buch","fromEmail":"benni.buch@gmx.de","sentAt":"2009-09-04T08:18:03Z","receivedAt":"2009-09-04T08:18:03Z","isPatch":false,"sender":{"key":"benni.buch@gmx.de","avatar":"https://gravatar.com/avatar/76977471fc2129a2866767588b6699227cc6e16cd2c4603837873d81529bff01?d=mp&s=160"},"body":"Hi Michael,\n\nthank you for your answer.\n\nStrangely, I can't reproduce the error  today.\nAs I did quite a lot branching and merging yesterday (learning git),\nI can't remember the steps that led to the error.\n\nAnd it doesn't have to be an error though -\nperhaps it was just my clouded perception due to the lots of branches.\n\nBut I will keep an eye on this and see if it happens again.\n\nSorry for bothering,\n\n- benjamin\n\n\nAm 04.09.2009 um 09:41 schrieb Michael J Gruber:\n\n> Benjamin Buch venit, vidit, dixit 03.09.2009 18:59:\n>> I made a branch and deleted a folder there with git rm -rf  \n>> foldername.\n>> So now i have to branches, A with the folder and B without the  \n>> folder.\n>>\n>> I'm on B, the folder is not there.\n>> Then I check out A, the folder shows up like it should.\n>> When I check out B again, the folder is still there.\n>>\n>> A git rm -rf folder gives me:\n>>\n>> \tfatal: pathspec 'folder/' did not match any files\n>>\n>> , so git is not tracking the folder.\n>>\n>> I can rm -rf the filder without git and start the whole game from the\n>> beginning,\n>> but there has to be a better way?\n>>\n>> Strange enough this happens just to two folders I removed,\n>> with others there is no problem.\n>\n> What does \"git status\" say when you've checked out B? Could some\n> contents of folder/ possibly be being ignored (.git/info/excludes  \n> etc.)?\n>\n> Michael\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"122396","messageId":"20090904082708.GA17157@coredump.intra.peff.net","threadId":"20834","inReplyTo":"34230C98-81B8-4DC8-846F-8B6FA2A022DA@gmx.de","subject":"Re: Deleted folder keeps showing up?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-09-04T08:27:09Z","receivedAt":"2009-09-04T08:27:09Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Sep 03, 2009 at 06:59:18PM +0200, Benjamin Buch wrote:\n\n> I made a branch and deleted a folder there with git rm -rf foldername.\n> So now i have to branches, A with the folder and B without the folder.\n> \n> I'm on B, the folder is not there.\n> Then I check out A, the folder shows up like it should.\n> When I check out B again, the folder is still there.\n\nIs there anything in the folder, like untracked files generated by your\nbuild process? Remember that git tracks full paths, not directories. So\nyou never actually \"deleted a folder\" but rather deleted all of the\npaths inside that folder.\n\nWhen you switch to branch A, git creates the folder, because it contains\ntracked files. When you switch back to branch B, git will remove the\ntracked files, and will remove the directory _only_ if it is then empty.\nAnything else would mean deleting your untracked files, which may be\nprecious.\n\nYou mentioned in a later email that you were having trouble reproducing\nthe issue.  Try:\n\n  $ git checkout A\n  $ make ;# or whatever your build process is, or\n         ;# normal work or whatever\n  $ git checkout B\n\nand see if that reproduces it.\n\n-Peff\n"},{"id":"122398","messageId":"7vfxb3yuma.fsf@alter.siamese.dyndns.org","threadId":"20834","inReplyTo":"8E56979B-5D85-4844-A492-8149EE9E9B2F@gmx.de","subject":"Re: Deleted folder keeps showing up?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-04T08:36:13Z","receivedAt":"2009-09-04T08:36:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Benjamin Buch <benni.buch@gmx.de> writes:\n\n> Strangely, I can't reproduce the error  today.\n\nIf a branch has dir/file tracked, and another branch does not have\nanything tracked in dir/ directory at all, then switching from the former\nbranch to the latter can remove dir/ only when you do not have any\nuntracked files in there when you switch.  Otherwise dir/ must stay\nbehind to keep the untracked files.\n\nYou can see it by a simple experiment.\n\n    $ rm -fr trial\n    $ mkdir trial\n    $ cd trial\n    $ git init\n    $ >elif\n    $ git commit -m initial\n    $ git branch lacksdir\n    $ mkdir dir\n    $ >dir/file\n    $ git add dir/file\n    $ git commit -m add-dir-file\n\nNow, after this set-up, your 'master' has dir/file and 'lacksdir' does\nnot have anything tracked in dir/ directory.\n\nObserve:\n\n    $ git checkout lacksdir\n    $ find ??*\n    elif\n    $ git checkout master\n    $ find ??*\n    dir\n    dir/file\n    elif\n    $ >dir/garbage\n    $ git checkout lacksdir\n    $ find ??*\n    dir\n    dir/garbage\n    elif\n\nIf switching to 'lacksdir' removed the dir/ directory, whatever was in the\nuntracked file dir/garbage will be lost.  In the above exercise, I named\nit garbage, so a casual reader might get a false impression that it should\nbe thrown away, but in real life workflow, it often happens that\n\n (1) you start doing some interesting experimental changes, while on\n     'master';\n\n (2) you realize that this change does not belong to 'master', but belongs\n     to some other branch, perhaps 'lacksdir';\n\n (3) you switch to the branch, to keep working.\n\nRemember that, in git, your uncommitted changes to the index and the work\ntree do not belong to the branch.  They try to follow you across branch\nswitching.  Since untracked new files are something potentially you might\nwant to add after branch switching, we do not remove them.  And because we\nchoose not to remove dir/file, even though the commit at the tip of the\nlacksdir branch does not have anything tracked in dir/ directory, we\ncannot remove it from the work tree.\n"},{"id":"122595","messageId":"53F9526D-E31D-4027-8871-8468AB476E6D@gmx.de","threadId":"20834","inReplyTo":"7vfxb3yuma.fsf@alter.siamese.dyndns.org","subject":"Re: Deleted folder keeps showing up?","fromName":"Benjamin Buch","fromEmail":"benni.buch@gmx.de","sentAt":"2009-09-07T08:17:05Z","receivedAt":"2009-09-07T08:17:05Z","isPatch":false,"sender":{"key":"benni.buch@gmx.de","avatar":"https://gravatar.com/avatar/76977471fc2129a2866767588b6699227cc6e16cd2c4603837873d81529bff01?d=mp&s=160"},"body":"Hi Junio,\n\nthanks for the explanation!\n\nIt made things a lot clearer for me.\nAnd I think that could be exactly what happened\nand the reason why I couldn't reproduce the 'error'.\n\n-benjamin\n\nAm 04.09.2009 um 10:36 schrieb Junio C Hamano:\n\n> Benjamin Buch <benni.buch@gmx.de> writes:\n>\n>> Strangely, I can't reproduce the error  today.\n>\n> If a branch has dir/file tracked, and another branch does not have\n> anything tracked in dir/ directory at all, then switching from the  \n> former\n> branch to the latter can remove dir/ only when you do not have any\n> untracked files in there when you switch.  Otherwise dir/ must stay\n> behind to keep the untracked files.\n>\n> You can see it by a simple experiment.\n>\n>    $ rm -fr trial\n>    $ mkdir trial\n>    $ cd trial\n>    $ git init\n>    $ >elif\n>    $ git commit -m initial\n>    $ git branch lacksdir\n>    $ mkdir dir\n>    $ >dir/file\n>    $ git add dir/file\n>    $ git commit -m add-dir-file\n>\n> Now, after this set-up, your 'master' has dir/file and 'lacksdir' does\n> not have anything tracked in dir/ directory.\n>\n> Observe:\n>\n>    $ git checkout lacksdir\n>    $ find ??*\n>    elif\n>    $ git checkout master\n>    $ find ??*\n>    dir\n>    dir/file\n>    elif\n>    $ >dir/garbage\n>    $ git checkout lacksdir\n>    $ find ??*\n>    dir\n>    dir/garbage\n>    elif\n>\n> If switching to 'lacksdir' removed the dir/ directory, whatever was  \n> in the\n> untracked file dir/garbage will be lost.  In the above exercise, I  \n> named\n> it garbage, so a casual reader might get a false impression that it  \n> should\n> be thrown away, but in real life workflow, it often happens that\n>\n> (1) you start doing some interesting experimental changes, while on\n>     'master';\n>\n> (2) you realize that this change does not belong to 'master', but  \n> belongs\n>     to some other branch, perhaps 'lacksdir';\n>\n> (3) you switch to the branch, to keep working.\n>\n> Remember that, in git, your uncommitted changes to the index and the  \n> work\n> tree do not belong to the branch.  They try to follow you across  \n> branch\n> switching.  Since untracked new files are something potentially you  \n> might\n> want to add after branch switching, we do not remove them.  And  \n> because we\n> choose not to remove dir/file, even though the commit at the tip of  \n> the\n> lacksdir branch does not have anything tracked in dir/ directory, we\n> cannot remove it from the work tree.\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"}]}