将当前的Git分支设为主分支

空扰寡人 提交于 2020-04-05 19:13:46

问题:

I have a repository in Git. 我在Git中有一个存储库。 I made a branch, then did some changes both to the master and to the branch. 我做了一个分支,然后对母版和分支进行了一些更改。

Then, tens of commits later, I realized the branch is in much better state than the master, so I want the branch to "become" the master and disregard the changes on master. 然后,在数十次提交之后,我意识到分支的状态要比主服务器好得多,因此我希望分支“成为”主服务器,而忽略主服务器上的更改。

I cannot merge it, because I don't want to keep the changes on master. 我无法合并它,因为我不想将更改保留在主文件上。 What should I do? 我该怎么办?

Extra : In this case, the 'old' master has already been push -ed to another repository such as GitHub. 附加 :在这种情况下,“旧”母版已经push送到另一个存储库,例如GitHub。 How does this change things? 这如何改变事情?


解决方案:

参考一: https://stackoom.com/question/Bamc/将当前的Git分支设为主分支
参考二: https://oldbug.net/q/Bamc/Make-the-current-Git-branch-a-master-branch
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!