合并两个分支时git合并模糊

时间:2021-07-21 19:56:49

When I was working on merging couple of branches, i have accidentally created a branch instead of merging,

当我正在合并几个分支时,我不小心创建了一个分支而不是合并,

Example :

示例:

I was checking the list of branches available in the local and origin by typing git branch. But accidentally i have executed git branch origin/DEV66 (origin/DEV66 is the branch i need to merge with the branch test).

我通过输入git branch来检查本地和原点中可用的分支列表。但不小心我已经执行了git branch origin / DEV66(origin / DEV66是我需要与分支测试合并的分支)。

So I have the following problem when merging the branch test and origin/DEV66

因此,在合并分支测试和origin / DEV66时,我遇到以下问题

warning: refname 'origin/DEV_66' is ambiguous.
warning: refname 'origin/DEV_66' is ambiguous.

When typing git branch it shows the following branches

键入git branch时,它显示以下分支

GRNDEV_893
heads/origin/GRNDEV_893
remotes/origin/GRNDEV_893

How to resolve this ambiguity and is there is any different between the branches heads/origin/GRNDEV_893 and remotes/origin/GRNDEV_893.

如何解决这种歧义,分支head / origin / GRNDEV_893和remotes / origin / GRNDEV_893之间有什么不同。

2 个解决方案

#1


3  

Branches in heads/ are branches local to your repository, which you've created in this clone with git branch or git checkout -b. Branches in remotes/ are remote tracking branches, which are read-only copies of branches from other clones that are updated with you run a git fetch or a git pull.

head / branches中的分支是您的存储库本地的分支,您使用git branch或git checkout -b在此克隆中创建了该分支。远程跟踪分支是远程跟踪分支,它是来自其他克隆的分支的只读副本,随着您运行git fetch或git pull而更新。

When you have branches with the same name in both, you can disambiguate by including the heads/ or remotes/ prefix:

如果两个分支都具有相同的名称,则可以通过包含头/或远程/前缀来消除歧义:

git checkout test
git merge remotes/origin/DEV_66

Since you created heads/origin/DEV_66 by mistake, you can delete it like so:

由于你错误地创建了head / origin / DEV_66,你可以像这样删除它:

git branch -d heads/origin/DEV_66

#2


0  

git branch -rv will show all branches including remote branches, and commit each branch is pointing to at the moment. You can further inspect each branch by viewing log:

git branch -rv将显示包括远程分支在内的所有分支,并且提交每个分支当前都指向。您可以通过查看日志进一步检查每个分支:

git log BRANCHNAME

In case some branches are identical and you would like to delete them, you can do that using

如果某些分支是相同的并且您想要删除它们,则可以使用它们

git branch -d BRANCHNAME

#1


3  

Branches in heads/ are branches local to your repository, which you've created in this clone with git branch or git checkout -b. Branches in remotes/ are remote tracking branches, which are read-only copies of branches from other clones that are updated with you run a git fetch or a git pull.

head / branches中的分支是您的存储库本地的分支,您使用git branch或git checkout -b在此克隆中创建了该分支。远程跟踪分支是远程跟踪分支,它是来自其他克隆的分支的只读副本,随着您运行git fetch或git pull而更新。

When you have branches with the same name in both, you can disambiguate by including the heads/ or remotes/ prefix:

如果两个分支都具有相同的名称,则可以通过包含头/或远程/前缀来消除歧义:

git checkout test
git merge remotes/origin/DEV_66

Since you created heads/origin/DEV_66 by mistake, you can delete it like so:

由于你错误地创建了head / origin / DEV_66,你可以像这样删除它:

git branch -d heads/origin/DEV_66

#2


0  

git branch -rv will show all branches including remote branches, and commit each branch is pointing to at the moment. You can further inspect each branch by viewing log:

git branch -rv将显示包括远程分支在内的所有分支,并且提交每个分支当前都指向。您可以通过查看日志进一步检查每个分支:

git log BRANCHNAME

In case some branches are identical and you would like to delete them, you can do that using

如果某些分支是相同的并且您想要删除它们,则可以使用它们

git branch -d BRANCHNAME