I have made bad commits in the github and i want to do the following things:
Is it possible to do this?
The key command is:
git checkout -B master aSHA1
If you know where you want to reset your master branch, that is the way to do it in one line.
From git checkout
man page:
-B <new_branch>
Creates the branch
<new_branch>
and start it at<start_point>
;
if it already exists, then reset it to<start_point>
. This is equivalent to running "git branch
" with "-f
";
Then you can force push it:
git push --force
That will reset origin/master
(the master branch on the GitHub side) to your old SHA1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With