Suppose that I have stashed some changes and I want to add further changes into the same stash (such as stash@{0}
). Is there an easy way to do this? What about combining two stashes into a single one?

- 24,264
- 12
- 69
- 143

- 114,675
- 90
- 247
- 350
-
What's preventing you from just restoring the stash, modifying it, and stashing it again. If you want to combine to stashes, just get both of them, and store it again. – Leif Andersen Nov 09 '11 at 04:22
-
1@LeifAndersen: It's a pain when you have further changes that you don't want to add into the stash – Casebash Nov 09 '11 at 04:27
-
Stash the changes you don't want in there first? – Leif Andersen Nov 09 '11 at 04:52
4 Answers
I don't think we have to follow all these steps,
git stash pop [this will apply your last stashed changes stash{@0}] then again say, git stash [this will create new stash will all the changes to stash@{0}]

- 241
- 2
- 3
-
1I am not sure why someone has down-voted this answer, as it seems to be valid... at least in most of the cases :) – Maciek Talaska Feb 05 '16 at 01:21
-
`Simple is better than complex.` https://www.python.org/dev/peps/pep-0020/#id2 – Osama Dar Jan 24 '22 at 20:54
-
It's just not what op's question is. Supposed I have changed file A and file B and then stashed file A into stash 0. Then I continued working on file A such as it is now A'. I would then like to stash file B alongside the original file A. I don't want to unstash, effectively merging A into A'. It's a different set of operations. https://stackoverflow.com/a/8060523/7821547 has the right explanation for the mechanic OP is asking about. – Holy Jan 12 '23 at 18:10
I don't see any "git stash
" option allowing to modify an existing git stash.
A possible way to achieve this would be:
- stash your additional changes (
stash@{1}
) - stash everything else (
stash@{2}
) - create a
tmp
branch from the commit (HEAD
) your are currently modifying git stash pop
twicegit stash
, creating a newstash@{1}
with both content in it,- deleting your temporary branch and checkouting the initial branch you where in
git stash pop
once (to restore all the pending changes)- continue your selective stash
Five years later, Powerslave proposes in the comments:
The branching magic is completely unnecessary.
You could simply
- Create a new stash with whatever you have.
git stash apply
both changesets (you cangit stash pop
instead, but in that case you're in trouble if you accidentally screw up).- Create a new stash with these merged changes.
git stash drop
the other two changesets if you usedapply
instead ofpop
-
@Casebash: I agree. Time for writing a patch to add this feature, but I suspect the problem can quickly becomes quite complex to manage. – VonC Nov 09 '11 at 05:07
-
If you want some ideas, consider the TortoiseHg Workbench Shelve tool. Its workflow works really well for this kind of problem: Create shelves and add or remove stuff from them as you like from your working copy, or even between shelves. – Andre Luus Aug 30 '16 at 15:50
-
5That's overcomplicated, I believe. The branching magic is completely unnecessary. You could simply 1. Create a new stash with whatever you have. 2. `git stash apply` both changesets (you can `git stash pop` instead, but in that case you're in trouble if you accidentally screw up). 3. Create a new stash with these merged changes. 4. `git stash drop` the other two changesets if you used `apply` instead of `pop` – Powerslave Oct 21 '16 at 11:50
-
@Powerslave Nice. I guess I did not thought of that 5 years ago. I have included your comment in the answer for more visibility. – VonC Oct 21 '16 at 11:53
-
@VonC Nevertheless thank you for your answer! I was interested if there is any convenient way around and you pointed out just what I wanted to know. Forgot to hit +1, sorry, I'll follow up now. – Powerslave Oct 21 '16 at 13:10
-
when i attempt this...i get "Your local changes to the following files would be overwritten by merge - Aborting" – Tim Boland May 03 '17 at 22:52
-
@TimBoland It is best to ask a new question with specific details, to see why you get that message. – VonC May 04 '17 at 04:40
An old question, but I feel it still is missing the right answer: Do not use git stash
, use temporary commits and/or temporary branches.
Suppose that I have stashed some changes and I want to add further changes into the same stash (such as stash@{0}). Is there an easy way to do this?
Yes, when you use normal, uncomplicated commits, this is just a normal interactive rebase with an edit
action.
What about combining two stashes into a single one?
When you use normal, uncomplicated commits, this is just a normal interactive rebase with a fixup
action.

- 26,565
- 10
- 94
- 165
You cannot add new changes to an old stash, but you can combine and create a new stash that includes both your current changes and the old stash. Here's how you can do it:
- Create the initial stash:
git stash save -u "initial stash"
- Make further changes that you want to add to the initial stash in your repository.
- Stage all the changes:
git add .
- List all the stashes available in your repository:
git stash list
You will see an output like this:
stash@{0}: On main: initial stash
- Apply your initial stash on top of your additional changes:
git stash apply stash@{0}
- (Optional step) Resolve any conflicts that may arise between your initial stash and the current changes using your IDE.
- Create a new stash that combines your initial stash changes and the recent changes:
git stash save -u "initial stash combined with new changes"
- Apply your combined stash:
git stash apply stash@{0}
- Delete your initial stash:
git stash drop 1
You will see an output like this:
Dropped refs/stash@{1}
By following these steps, you can effectively combine your initial stash with new changes and continue your work.

- 2,339
- 19
- 22