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
switching to a new branch losing changes:
git checkout -b YOUR_NEW_BRANCH_NAME --force
switching to an existing branch losing changes:
git checkout YOUR_BRANCH --force