How can I remove the last commit from a remote Git repository such as I don’t see it any more in the log?
If for example git log gives me the following commit history
A->B->C->D[HEAD, ORIGIN]
how can I go to
A->B->C[HEAD,ORIGIN]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Be aware that this will create an "alternate reality" for people who have already fetch/pulled/cloned from the remote repository. But in fact, it’s quite simple:
If you want to still have it in your local repository and only remove it from the remote, then you can use:
Some shells interpret the
^character. For those shells, either quote/escape or use~: