I’m working with Git on a project, and for reasons I don’t need to get in to, I’m finding that I may have to make some changes to the code, then stash them as opposed to committing them. I may need these changes sometimes, but not all the time and don’t necessarily want them to be permanent. However, the job could be big one and I’d like to try to save myself some problems.
Suppose I save multiple git stashes so my stash looks like this:
stash@{0}: First change
stash@{1}: Second change
...
stash@{10}: Last and final change
Is there a way to pop all of these changes in a single command? Or perhaps combine them together into something like stash@{11}: All previous changes together?
Or is this even a good idea at all?
EDIT: After some research, I realized that I really just should be branching and not using git stash in this way. Thanks for the answers!
Or, maybe make a branch? Branches are cheap in Git and won’t be pushed to a remote repo unless you tell Git so. Example in practice.
Create a branch named “my-hidden-feature” :
Edit and commit things (for instance, a local configuration file) :
Return to your original code and do some work :
Oh, are you in need of the hidden feature? Easy :
And, on and on!
Ah, last but not least. If you’re working from the command line, I highly recommend tools like oh-my-zsh that have a plugin that can display the current branch in your terminal. Very, very useful if you do not want to get lost in Git limbo.