Scenario
I have a solution, cloned to my local machine, and I have made a few changes to the master branch (but I have not committed them yet).
Problem
The work isn't finished, so I want to commit these changes into their own branch for the time being, but I've been working in master.
How can I commit changes in master to their own branch?
Just to be on the safe side, stash your work first, then create your branch:
git stash
git checkout -b newbranch
git stash pop
# work, add and commit in newbranch
git checkout master
# resume working on master