How to undo the initial commit on a remote repository in git?

ⅰ亾dé卋堺 提交于 2019-12-05 01:20:21

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
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!