Normal flow is to checkout DEV branch, change/add files, then do git checkout -b feature/X1
, commit, push, checkout DEV, repeat.
However, I’ve checked out DEV, made too many changes, now realize some changes need to go in feature/X2, and some in feature/X3.
Now if I do a git checkout -b feature/X2
, and only stage and commit some files, I’m now on the wrong branch to create X3. I really want to get back to DEV with my remaining files, then do a git checkout -b feature/X4
or similar.
Once I tried using git stash, but ended un unrecoverably breaking my repo requiring deletion and re-cloning. There are some gotchas in stash and unstash that got me.
Any suggestions to a foolproof way to do this, other than copy the changed files to another folder?