Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

删除master分支,并迁移到main分支 #2

Open
ITS-PLAY opened this issue Jan 13, 2021 · 0 comments
Open

删除master分支,并迁移到main分支 #2

ITS-PLAY opened this issue Jan 13, 2021 · 0 comments

Comments

@ITS-PLAY
Copy link
Owner

ITS-PLAY commented Jan 13, 2021

1)使用以下命令将本地master分支移到main:
git branch -m master main
2)删除远程的master分支:
git push origin --delete master
3)将远程main分支内容,合并到本地main分支:
git pull origin main --allow-unrelated-histories (消除文件不一致导致的git pull错误)
4)将本地main推送到远程main:
git push -u origin main

附:
推送本地分支local_branch到远程分支 remote_branch并建立关联关系

  a.远程已有remote_branch分支并且已经关联本地分支local_branch且本地已经切换到local_branch

          git push

 b.远程已有remote_branch分支但未关联本地分支local_branch且本地已经切换到local_branch

         git push -u origin/remote_branch

 c.远程没有remote_branch分支并,本地已经切换到local_branch

        git push origin local_branch:remote_branch

参考链接:
https://blog.csdn.net/torpidcat/article/details/81252505
https://blog.csdn.net/weixin_39737831/article/details/110411984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant