Scenario: Mistakenly make a new commit on master branch, this commit should be made on a new branch dev
.
Steps:
// on master branch
git branch dev
git reset --hard HEAD^
Then the new commit will be moved to dev
, and master
will lose this commit.
BE AWARE, we don't normally do reset
on master
.
网友评论