I frequently run into a problem where I commit something to master by mistake which should be in some brand new branch. How to fix this?
I found the below commands from https://ohshitgit.com/#accidental-commit-master which helped me.
I found the below commands from https://ohshitgit.com/#accidental-commit-master which helped me.
# create a new branch from the current state of master
git branch some-new-branch-name
# remove the last commit from the master branch
git reset HEAD~ --hard
git checkout some-new-branch-name
# your commit lives in this branch now :)
No comments:
Post a Comment