[ACCEPTED]-Create branch from current working tree and reset to HEAD-branch
Accepted answer
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
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.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.