为什么我的分支代码试图通过Intellij推动掌握
I am working in my own git branch and I want to do my commit to my branch. But it is trying to push the code to master instead. And obviously master is protected. So I cannot directly merge there. How to solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在顶部的工具栏中,转到 git ,将出现一个下拉菜单。单击分支(或使用快捷键 ctrl + shift +`)。
有关存储库的分支机构的菜单将出现。
*在Intellij的较新版本中,您必须单击左上角的3个点,然后将出现工具栏,您将
在遥控器下找到git * ,您将有两个分支机构,Main和Master 。 单击主箭头并删除它...
,您都设置了。下次您提交并推动一些东西时,它将自动推到主分支!!!
(要检查它是否有效,在执行我提到的任何事情之后,单击“ ctrl + shift + k ”,提交和推动窗口将出现。在那里,您会发现“” Main->原点:Main “大声告诉它将将更改推向主分支
In the Tool Bar on the top, go to Git, and a drop-down menu will appear. Click on Branches (or use the Shortcut Key Ctrl + Shift + ` ).
A menu will appear regarding the branches of your repositories.
*In the newer versions of IntelliJ, you have to click on the 3 dots in the top left corner and then the Tool Bar will appear where you will find Git *
Under the Remote, you would have two branches, main and master. Click on the side arrow of master and delete it...
And you're all set. Next time you Commit and Push something, it will automatically be pushed to the main branch!!!
(To check if it works, after doing whatever I mentioned, click "Ctrl + Shift + K" and the Commit and Push window will appear. There, you will find "main -> origin : main" which is loudly telling out that it is going to push the changes to the main branch)
使用CTRL + Shift + K进行推动,目标分支可以进行编辑和更改。
左侧是您正在工作的本地分支,右侧是目标远程分支,默认情况下它们具有相同的名称。
我的屏幕快照
use Ctrl + Shift + K to push, the target branch can be edit and change.
Left is the local branch you're working on, right is the target remote branch, they have the same name by default .
my screenshot