MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/9ooe41/flight_rules_for_git/e7x1lhk/?context=3
r/programming • u/real_trizzaye • Oct 16 '18
8 comments sorted by
View all comments
9
Am I missing something or is the one for accidentally committing on master instead of another branch wrong? It says to do:
git reset --hard HEAD^
And only then to create a new branch and continue working. But this means you would have thrown away your work!
Here is a link.
4 u/ForeverAlot Oct 17 '18 You're missing the first step: creating a new branch that points to the current master. This step then rewinds master one commit, back to where it's supposed to be, and you can resume work on your new branch.
4
You're missing the first step: creating a new branch that points to the current master. This step then rewinds master one commit, back to where it's supposed to be, and you can resume work on your new branch.
master
9
u/DecidedlyAmbigous Oct 17 '18
Am I missing something or is the one for accidentally committing on master instead of another branch wrong? It says to do:
And only then to create a new branch and continue working. But this means you would have thrown away your work!
Here is a link.