Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add further changes to a stash in Git

Tags:

git

git-stash

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?

like image 613
Casebash Avatar asked Nov 09 '11 04:11

Casebash


People also ask

How do I make changes after stash?

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.

How do I add something to an existing 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.

How do I stage stash changes in git?

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.


1 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}]

like image 93
Ram Sinha Avatar answered Sep 22 '22 05:09

Ram Sinha