Reputation: 4912
In which scenario stash command should be used ?
1) Let's assume i have a branch(b1) and there is a file(f1) that i haven't staged. When i create a new branch(b2) from branch(b1), my file(f1) wouldn't be available in the new branch(b2).
2)But if i had staged file(f1) in branch(b1) then file(f1) would be available in the new branch(b2) because the file(f1) isn't commited yet. This should not happen and that is why we use stash command?
Please correct me if this is wrong and provide additional informations related to stash
Upvotes: 1
Views: 137
Reputation: 3184
For my opinion, the most "classic" scenario for stash usage:
Upvotes: 3
Reputation: 439
git stash
will store you working directory
checkout your branch
git pop
will apply your working directory to this checked out branch
if f1 is the only not staged file it will pop up as it was before you stashed
Upvotes: 0