this happens to every developer time-to-time. You start coding a new feature and forget to branch first locally.
So if that happens is there a way I can say hey, transfer these uncommitted (or committed - yea I know those are both two scenarios which I'd like to cover with this) to a new branch for me locally so I don't have to back them out and copy my changes to a new branch to be able to carry on my way?
解决方案
If you haven't commited your changes yet, you can switch to a new branch prior to committing.
git checkout -b my-new-branch
This will create a new branch called my-new-branch and immediately check it out.