git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* --work-tree does not work for git-stash
@ 2017-09-11 18:32 Allen Li
  2017-09-11 18:59 ` Allen Li
  0 siblings, 1 reply; 2+ messages in thread
From: Allen Li @ 2017-09-11 18:32 UTC (permalink / raw)
  To: git

$ git --version
git version 2.14.1.581

This does not work:

$ git --git-dir ~/foo/.git --work-tree ~/foo stash create
fatal: /usr/lib/git-core/git-stash cannot be used without a working tree.

This does:

$ git --git-dir ~/foo/.git --work-tree ~/foo -C ~/foo stash create

I found a description of the bug here:

https://stackoverflow.com/a/5863555

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: --work-tree does not work for git-stash
  2017-09-11 18:32 --work-tree does not work for git-stash Allen Li
@ 2017-09-11 18:59 ` Allen Li
  0 siblings, 0 replies; 2+ messages in thread
From: Allen Li @ 2017-09-11 18:59 UTC (permalink / raw)
  To: git

On Mon, Sep 11, 2017 at 11:32 AM, Allen Li <vianchielfaura@gmail.com> wrote:
> $ git --version
> git version 2.14.1.581
>
> This does not work:
>
> $ git --git-dir ~/foo/.git --work-tree ~/foo stash create
> fatal: /usr/lib/git-core/git-stash cannot be used without a working tree.
>
> This does:
>
> $ git --git-dir ~/foo/.git --work-tree ~/foo -C ~/foo stash create
>
> I found a description of the bug here:
>
> https://stackoverflow.com/a/5863555

I think that this bug may be quite serious.

If you were to run:

$ git --git-dir ~/tmp/.git stash

This will actually stash using your current directory as the worktree,
which could potentially screw up things quite seriously.  In my case,
I had an unstaged file at ~/tmp/tmp, so Git decided to remove the
entire ~/tmp directory as my current directory was ~ and I have a git
repo in ~ for my dotfiles.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-11 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 18:32 --work-tree does not work for git-stash Allen Li
2017-09-11 18:59 ` Allen Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).