I was working on a git branch and was ready to commit my changes, so I made a commit with a useful commit message. I then absentmindedly made minor changes to the code that
If you have made changes to files that Git also needs to change when switching branches, it won't let you. To discard working changes, use:
git reset --hard HEAD
Then, you will be able to switch branches.