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?
To retrieve changes out of the stash and apply them to the current branch you're on, you have two options: git stash apply STASH-NAME applies the changes and leaves a copy in the stash. git stash pop STASH-NAME applies the changes and removes the files from the stash.
As with any commit, you cannot change anything about it once it's made. All you can do is make a new, different commit—or in this case, a new, different stash—that has the content you want, and stop using the old one.
Stage all your files that you need to stash. Run git stash --keep-index . This command will create a stash with ALL of your changes (staged and unstaged), but will leave the staged changes in your working directory (still in state staged). Now your "good stash" has ONLY staged files.
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}]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With