How I experiment with codes and libraries using Git Stash?

How I experiment with codes and libraries using Git Stash?

Software Development and problem solving in general requires a lot of trial and error.

For programming, versioning tools such Git helps experiment different strategies without losing work.

Whenever I focus on a problem, within reasonable time constraint, I try coding different solutions even if I will finally choose only one. Moreover, at this point, I prefer not optimising my codes when coding but instead, to make it work before eventually rewriting it to make it simpler and clearer to be understood by another developer.

Now to make sure I don't lose any valuable work, I stash it. If later, I need to retrieve it, I use git stash show -p [email protected]{N}, where N is the stash number. I also try stashing a minimum amount of code, so that there aren't numerous merge conflicts if they do occur.

How this can help you?

Even if you are not necessarily experimenting with codes, git stash can be useful. Assume you're working on a task when you are assigned an urgent ticket of something breaking on production. You can quickly stash your work and resume it later - particularly if you don't want to commit and push them on your branch.