If my very first commit is wrong, yet pushed to a (currently private) remote, how do I undo that commit on the remote?
I'm guessing I can just amend and then push --force?
By deleting your HEAD
you can restore your repository to a new state, where you can create a new initial commit:
git update-ref -d HEAD
After you create a new commit you will need to force it to the remote in order to overwrite the previous initial commit:
git push --force origin
If you've just one commit (initial commit), you can do as
git commit --amend
git push --force origin
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.