Git move most recent commits to
2021-03-12 本文已影响0人
JaedenKil
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
.