Reputation: 615
When I did git stash push <path/to/file>
it created stash@{0}
for it.
Reusing the same command with different file creates another stash -> stash@{1}
.
I have other files that logically belong to stash@{0}.
Can I somehow push file to existing stash?
Upvotes: 22
Views: 11498
Reputation: 6762
As per git docs,
<stash>
This option is only valid for apply, branch, drop, pop, show commands.
A reference of the form
stash@{<revision>}
. When no<stash>
is given, the latest stash is assumed (that is,stash@{0}
).
So you can't do this directly using push
command of git stash
.
Probably use this git stash push <path/to/file1> <path/to/file2> ...
next time as push
accepts multiple pathspecs (filenames)
Upvotes: 3
Reputation: 9679
If you mean akin to git commit --amend
, I am afraid you are out of luck, but would it be acceptable for your use case, to:
git stash pop
and then
git stash push ORIGINAL_FILES MORE_FILES
to have the files grouped?
Upvotes: 22