DEV Community

loading...

Discussion on: Confused by git? Here's a git crash course to fix that 🎉

Collapse
chrisachard profile image
Chris Achard Author

Thanks - and yeah, I'm realizing that I didn't explain stash... like at all in the post 🤦‍♂️ oops.

Stash is a temporary place you can put work in progress. Usually, the workflow goes something like this:

  • You are working on something in your working directory

  • a high priority bug comes in. To fix it, you have to switch branches and clear your working directory of the changes you already have made

  • instead of trying to save your work for later in a commit or a special branch, etc, you can put it in the "stash" with git stash

  • Then you go and fix the high priority bug

  • later, you can re-apply what was in the stash with git stash apply or git stash pop (pop will remove it from the stash; apply just brings it back over)

  • then you can continue to work on whatever you were working on from bullet 1.

Hope that helps a bit! I probably should have had a separate point for it in the guide 😀