Writing code can be similar to writing tutorials. In both cases, you’ll typically need to create and work on multiple drafts before reaching the final version. In an ideal setting, you would write code for a feature, add that code to the staging area...
In my experience unless you are pretty much immediately popping the stash it’s much better just to make a branch and do a normal commit. I would recommend avoiding
git stashin general.