# Bug: git-stash fails for new file not staged for commit

2 messages from 2021-06-24 to 2026-01-21. Participants: Claas Augner, Jille Timmermans.
Thread: https://gitlist.dev/t/56001

## Claas Augner, 2021-06-24 15:42

Subject: Bug: git-stash fails for new file not staged for commit
Message-ID: <f139a5e1-242a-e23b-6eda-b8b49423d70b@lsp.net>
URL: https://gitlist.dev/e/f139a5e1-242a-e23b-6eda-b8b49423d70b%40lsp.net

```
 > What did you do before the bug happened?

I tried to stash a new file that I added with `git add --intent-to-add`:

ˋˋˋ
$ touch foo
$ git add --intent-to-add foo
$ git stash
ˋˋˋ


 > What did you expect to happen?

The file should have been stashed.


 > What happened instead?

The stash failed with the following error message:

ˋˋˋ
error: Entry 'foo' not uptodate. Cannot merge.
Cannot save the current worktree state
ˋˋˋ


 > What's different between what you expected and what actually happened?

Instead of stashing the file, the stash fails with an error message.


 > Anything else you want to add:

Background: https://github.com/okonet/lint-staged/issues/990


[System Info]
git version:
git version 2.32.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 
UTC 2020 x86_64
compiler info: gnuc: 9.3
libc info: glibc: 2.31
$SHELL (typically, interactive shell): /usr/bin/zsh


[Enabled Hooks]
applypatch-msg
pre-applypatch
post-applypatch
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-rebase
post-checkout
post-merge
pre-push
pre-receive
update
post-receive
post-update
push-to-checkout
pre-auto-gc
post-rewrite
sendemail-validate

-------------------------------------------
LSP.net GmbH
Prinzregentenstr. 40
10715 Berlin / Germany
T +49 30 20896331
Web: https://www.LSP.net
Blog: https://blog.LSP.net

```

## Jille Timmermans, 2026-01-21 12:30

Subject: Re: Bug: git-stash fails for new file not staged for commit
Message-ID: <5a81da1c-1cf7-4966-8be5-67139878a3e0@hexon.nl>
URL: https://gitlist.dev/e/5a81da1c-1cf7-4966-8be5-67139878a3e0%40hexon.nl
In-Reply-To: <f139a5e1-242a-e23b-6eda-b8b49423d70b@lsp.net>

```
On 24-06-2021 17:42, Claas Augner wrote:
> > What did you do before the bug happened?
>
> I tried to stash a new file that I added with `git add --intent-to-add`:
>
> ˋˋˋ
> $ touch foo
> $ git add --intent-to-add foo
> $ git stash
> ˋˋˋ
>
>
> > What did you expect to happen?
>
> The file should have been stashed.
>
>
> > What happened instead?
>
> The stash failed with the following error message:
>
> ˋˋˋ
> error: Entry 'foo' not uptodate. Cannot merge.
> Cannot save the current worktree state
> ˋˋˋ
>
>
> > What's different between what you expected and what actually happened?
>
> Instead of stashing the file, the stash fails with an error message.
>
>
> > Anything else you want to add:
>
> Background: https://github.com/okonet/lint-staged/issues/990
>
>
> [System Info]
> git version:
> git version 2.32.0
This bug is still present with git version 2.52.0.
> cpu: x86_64
> no commit associated with this build
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> uname: Linux 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 
> UTC 2020 x86_64
> compiler info: gnuc: 9.3
> libc info: glibc: 2.31
> $SHELL (typically, interactive shell): /usr/bin/zsh
>
>
> [Enabled Hooks]
> applypatch-msg
> pre-applypatch
> post-applypatch
> pre-commit
> prepare-commit-msg
> commit-msg
> post-commit
> pre-rebase
> post-checkout
> post-merge
> pre-push
> pre-receive
> update
> post-receive
> post-update
> push-to-checkout
> pre-auto-gc
> post-rewrite
> sendemail-validate
>
> -------------------------------------------
> LSP.net GmbH
> Prinzregentenstr. 40
> 10715 Berlin / Germany
> T +49 30 20896331
> Web: https://www.LSP.net
> Blog: https://blog.LSP.net
>

```
