문제

In my current branch I have several stashes:

  • stash@{0}
  • stash@{1}
  • stash@{2}
  1. If I apply stash@{0}:

    $ git stash apply stash{0}
    
  2. Modify this stash

  3. 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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top