无法在Bitbucket中合并无关分支 [英] Unable to merge unrelated branches in bitbucket

查看:187
本文介绍了无法在Bitbucket中合并无关分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是git的新手,但对它不是超级精通.我使用源代码树来提交和推送代码.我遇到了从未有过的奇怪问题.当我将分支合并到主分支时,会显示无法合并,不相关的分支".

I am new to git and not super tech savvy when it comes to it. I use source tree to commit and push code. I am running into strange issues which I never did before. When I merge my branch to the master I get this "Unable to merge, unrelated branches".

此外,我在回购中看到了奇怪的事情:

Moreover, I see strange things in my repo:

  1. 遥控器和本地人似乎根本没有连接

  1. 我总是收到提示进行身份验证的提示,但是该用户名错误,并且找不到更改它的方法:

在这方面的任何帮助都会很棒!

Any help in this regard would be great!

推荐答案

将新分支推送到远程时,需要设置本地分支以跟踪远程分支.有时它是自动的,这取决于您的Git配置.

When you push a new branch to a remote, you need to set the local branch to track the remote branch. Sometimes it's automatic, it depends on your Git config.

在命令行中,您可以使用-u参数执行此操作. 例如:git push origin HEAD -u的意思是:将当前分支(在HEAD所在的位置)推到远程原点,并将本地分支设置为跟踪远程分支.

With the command line, you would do this with the -u argument. For example: git push origin HEAD -u means: push the current branch (where HEAD is) to remote origin and set the local branch to track the remote one.

使用Sourcetree,我刚刚检查了UI,并且您有一个track选项.将新分支推送到遥控器时,请确保已选中此选项.

With Sourcetree, I just checked the UI, and you have a track option. Make sure this is checked when you push a new branch to a remote.

关于当前情况,您可以设法正确设置所有分支,但是您提到自己对git不太了解.我不想让你失去任何东西.

Regarding your current situation, you could manage to set all branches correctly but you mentioned you don't know git very well. I don't want you to lose anything.

检查此答案可能对您有帮助:制作现有的Git分支跟踪远程分支?

Checking this answer may help you: Make an existing Git branch track a remote branch?

在不使用Git命令的情况下可以做什么:

What you could do, without dealing with Git commands:

  • 仅当您的所有工作都在遥控器上时!
  • 删除本地分支(不要删除远程分支!).
  • 然后拉远程的.通常,当您结帐远程分支时,Git会自动将本地分支设置为跟踪远程分支.

我强烈建议您花一些时间来学习Git:

I highly recommend that you take some time to learn Git:

  • https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches
  • https://learngitbranching.js.org/

这篇关于无法在Bitbucket中合并无关分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆