In my current branch I have several stashes:
stash@{0}
stash@{1}
stash@{2}
If I apply stash@{0}
:
$ git stash apply stash{0}
Modify this stash
I want to save the changes to the current stash stash@{0}
I don't want to create a 4th stash I just want to update the first stash.
Can someone tell how to do this? I'm looking at the man page… perhaps I'm overlooking something.
You can stash your working tree and then drop the old one that you don't need.
git stash apply
# Make changes
git stash
git stash drop stash@{1}
Alternatively, you can pop instead of apply, which will drop the stash at the same time:
git stash pop
# make changes
git stash
Another alternative, if you already were already making the changes that you want to do before realizing that you want to merge the changes to the top of the stash:
# make changes
git add <all files>
git stash pop # or apply
git rm --cached <files that you want to merge>
git stash --keep-index
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句