答案 0 :(得分:1)
这里有一些说明,但是在您执行任何操作之前,请确保已备份所有内容。
要删除origin
上的远程分支(假设origin
是github):
git push origin :my-branch
您还应该能够以这种方式删除master
。
然后您可以创建一个新分支master-alternative
,如下所示:
git checkout -b master-alternative <hash>
master分支上的首次提交的哈希值在哪里。
然后:
git rm -r .
echo "Sorry, I forgot my password" > README.md
git add README.md
git commit --amend # make this change part of the first commit rather than a new commit
git push --force origin master-alternative:master # push current branch to origin under the name 'master', --force in case you were unable to delete 'master' previously