{"thread":{"id":"46736","subject":"--work-tree does not work for git-stash","startedAt":"2017-09-11T18:32:45Z","lastAt":"2017-09-11T18:59:30Z","messageCount":2,"participants":["Allen Li"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"327857","messageId":"CAJr1M6eS0jY22=0nvV41uDybcHUdjBv8CgRhHmBNFM=Z0J9YCA@mail.gmail.com","threadId":"46736","inReplyTo":null,"subject":"--work-tree does not work for git-stash","fromName":"Allen Li","fromEmail":"vianchielfaura@gmail.com","sentAt":"2017-09-11T18:32:39Z","receivedAt":"2017-09-11T18:32:45Z","isPatch":false,"sender":{"key":"vianchielfaura@gmail.com","avatar":null},"body":"$ git --version\ngit version 2.14.1.581\n\nThis does not work:\n\n$ git --git-dir ~/foo/.git --work-tree ~/foo stash create\nfatal: /usr/lib/git-core/git-stash cannot be used without a working tree.\n\nThis does:\n\n$ git --git-dir ~/foo/.git --work-tree ~/foo -C ~/foo stash create\n\nI found a description of the bug here:\n\nhttps://stackoverflow.com/a/5863555\n"},{"id":"327861","messageId":"CAJr1M6eXDiAEmaen+w5PCBLpSL1+=6RmyA=zgHuKV=aYbrRcdg@mail.gmail.com","threadId":"46736","inReplyTo":"CAJr1M6eS0jY22=0nvV41uDybcHUdjBv8CgRhHmBNFM=Z0J9YCA@mail.gmail.com","subject":"Re: --work-tree does not work for git-stash","fromName":"Allen Li","fromEmail":"vianchielfaura@gmail.com","sentAt":"2017-09-11T18:59:24Z","receivedAt":"2017-09-11T18:59:30Z","isPatch":false,"sender":{"key":"vianchielfaura@gmail.com","avatar":null},"body":"On Mon, Sep 11, 2017 at 11:32 AM, Allen Li <vianchielfaura@gmail.com> wrote:\n> $ git --version\n> git version 2.14.1.581\n>\n> This does not work:\n>\n> $ git --git-dir ~/foo/.git --work-tree ~/foo stash create\n> fatal: /usr/lib/git-core/git-stash cannot be used without a working tree.\n>\n> This does:\n>\n> $ git --git-dir ~/foo/.git --work-tree ~/foo -C ~/foo stash create\n>\n> I found a description of the bug here:\n>\n> https://stackoverflow.com/a/5863555\n\nI think that this bug may be quite serious.\n\nIf you were to run:\n\n$ git --git-dir ~/tmp/.git stash\n\nThis will actually stash using your current directory as the worktree,\nwhich could potentially screw up things quite seriously.  In my case,\nI had an unstaged file at ~/tmp/tmp, so Git decided to remove the\nentire ~/tmp directory as my current directory was ~ and I have a git\nrepo in ~ for my dotfiles.\n"}]}