{"thread":{"id":"52929","subject":"GIT_WORK_TREE; a recipe for disaster","startedAt":"2020-03-03T14:01:39Z","lastAt":"2020-03-03T14:22:53Z","messageCount":2,"participants":["Phillip Susi","Philip Oakley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"392778","messageId":"875zflh7dw.fsf@vps.thesusis.net","threadId":"52929","inReplyTo":null,"subject":"GIT_WORK_TREE; a recipe for disaster","fromName":"Phillip Susi","fromEmail":"phill@thesusis.net","sentAt":"2020-03-03T13:53:31Z","receivedAt":"2020-03-03T14:01:39Z","isPatch":false,"sender":{"key":"phill@thesusis.net","avatar":null},"body":"I'm using git for windows version 2.25.0.windows.1.  Yesterday I was in\na bash command line and changed directories to another project.  I ran\ngit status and it complained about basically everything being deleted\nwhen the files were sitting there just fine.  I thought that maybe it is\nconfused since I upgraded git recently and so I ran git checkout -f and\ngit clean -xfd to make sure that the working directory would be restored\nto a pristine state.  I later changed back to the first project\ndirectory where I was horrified to see that all of the files from the\nsecond project had been checked out, and the changes in that project\nthat I had been working on for a few days had been deleted.\n\nIt seems the cause of this is that I had opened git bash from the git\ngui menu instead of from the windows explorer menu.  In previous\nreleases, this cause GIT_DIR to be set ( I believe ), and so that\nsession of git bash was tied to that repoistory even if you changed\ndirectories to another repository.  I always thought this was rather\nannoying, but things seem to be worse now that I have upgraded, because\ngit now uses the index and hisotry log etc from the cwd, but compares\nthat index to files elsewhere.  This seems like a recipe for disaster.\nWhy does git gui set these environment variables at all, and could it\nplease stop?\n\n"},{"id":"392784","messageId":"c2cf7919-8a24-0b62-3f99-03bf50dcc659@iee.email","threadId":"52929","inReplyTo":"875zflh7dw.fsf@vps.thesusis.net","subject":"Re: GIT_WORK_TREE; a recipe for disaster","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2020-03-03T14:22:48Z","receivedAt":"2020-03-03T14:22:53Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 03/03/2020 13:53, Phillip Susi wrote:\n> I'm using git for windows version 2.25.0.windows.1.  Yesterday I was in\n> a bash command line and changed directories to another project.  I ran\n> git status and it complained about basically everything being deleted\n> when the files were sitting there just fine.  I thought that maybe it is\n> confused since I upgraded git recently and so I ran git checkout -f and\n> git clean -xfd to make sure that the working directory would be restored\n> to a pristine state.  I later changed back to the first project\n> directory where I was horrified to see that all of the files from the\n> second project had been checked out, and the changes in that project\n> that I had been working on for a few days had been deleted.\n>\n> It seems the cause of this is that I had opened git bash from the git\n> gui menu instead of from the windows explorer menu.  In previous\n> releases, this cause GIT_DIR to be set ( I believe ), and so that\n> session of git bash was tied to that repoistory even if you changed\n> directories to another repository.  I always thought this was rather\n> annoying, but things seem to be worse now that I have upgraded, because\n> git now uses the index and hisotry log etc from the cwd, but compares\n> that index to files elsewhere.  This seems like a recipe for disaster.\n> Why does git gui set these environment variables at all, and could it\n> please stop?\n>\nProbably worth including Pratyush Yadav for the git-gui maintenance aspect.\n--\nPhilip\n"}]}