Sometimes I'm in a feature branch, but I've made an unrelated change that I want to see in master. Often I can just do:
git checkout master
git commit -m "..." filename
But sometimes when I do the checkout I get a warning that there are local changes and thus I can't switch the branch.
Why does this only happen sometimes? Is there a workaround when I see this message? Maybe stash?