[ACCEPTED]-Create branch from current working tree and reset to HEAD-branch

Accepted answer
Score: 23

So, create a working branch:

git checkout -b working_branch

either commit 1 or stash your changes

git add <files>
git commit -m "message"

OR

git stash

Go back to master

git checkout master
git reset HEAD
Score: 16

If you haven't yet made a commit then you 6 don't need to move master, it's already 5 at the current HEAD. You can just checkout a 4 new branch with checkout -b, it doesn't need your working 3 tree to be clean.

E.g.

git checkout -b newtopic

You are now on newtopic and 2 can commit your working tree changes here. master doesn't 1 need to move.

More Related questions