I often find I'm working on a gitflow feature branch, and I stumble across something that I later realise actually needs to be a small update to dev (e.g. a configuration change not connected with the feature, but is needed in all branches based on the current dev). But I've already saved the code, so git sees unstaged changes. I think I can resolve this in 2 ways:
git stash, switch back to dev,git pop, commit, switch back to feature, rebase- commit to feature, switch to dev, cherry-pick, switch back to feature
Option 2 feels somehow easier, especially if there are other 'feature-only' changes involved in the initial set of commits needed to deal with all the unstaged changes. It also means I can finish whatever I was working on in feature before stepping aside to put whatever it was back into dev.
But, I'm new to git, and gitflow in particular, so not sure what else might be lurking waiting to bite me later. Is option 2 above a decent way to deal with this scenario? Are there others that would be better for any reason?