我发现这是最好的方法(我的服务器出现问题,不让我删除)。
在托管origin
存储库的服务器上,从存储库内的目录中键入以下内容:
git config receive.denyDeleteCurrent ignore
在您的工作站上:
git branch -m master vabandoned # Rename master on local
git branch -m newBranch master # Locally rename branch newBranch to master
git push origin :master # Delete the remote's master
git push origin master:refs/heads/master # Push the new master to the remote
git push origin abandoned:refs/heads/abandoned # Push the old master to the remote
回到托管origin
存储库的服务器上:
git config receive.denyDeleteCurrent true
感谢博文作者http://www.mslinn.com/blog/?p=772