git Git未合并的路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1946301/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git unmerged paths
提问by Rob
I have the following git status
and I need to get rid of the two plugins below:
我有以下内容git status
,我需要摆脱下面的两个插件:
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# unmerged: vendor/plugins/pluginA
# unmerged: vendor/plugins/pluginB
In issue is that I have a repository with a few branches that is shared between us and the client:
问题是我有一个包含几个分支的存储库,这些分支在我们和客户端之间共享:
master(client version of the code)
production(our production version of the code)
development(our development version of the code)
master(客户端版本代码)
production(我们的生产版本代码)
development(我们的开发版本代码)
Changes have been made in master
that we need to start using and I need to leave production
and development
alone. I've created a new "merge" branch (based on development) and merged the code from master. Unfortunately it has left us with the two plugin issues above. These were removed in the master
but are still in the development
branch. When merging I had messages like:
在已进行的更改master
,我们需要开始使用,我需要离开production
和development
孤独。我创建了一个新的“合并”分支(基于开发)并从 master 合并了代码。不幸的是,它给我们留下了上面的两个插件问题。这些已在 中删除,master
但仍在development
分支中。合并时,我收到以下消息:
CONFLICT (directory/file): There is a directory with name vendor/plugins/pluginA in HEAD. Adding vendor/plugins/pluginA as vendor/plugins/pluginA~master
CONFLICT(目录/文件):HEAD 中有一个名为 vendor/plugins/pluginA 的目录。将 vendor/plugins/pluginA 添加为 vendor/plugins/pluginA~master
Since I am trying to get the master
version, how can I just remove the plugins? Seems like most other deleted files were merged correctly.
由于我正在尝试获取master
版本,我该如何删除插件?似乎大多数其他已删除的文件都已正确合并。
Thanks!
谢谢!
回答by KurzedMetal
You got a conflict because git found a directory(vendor/plugins/pluginA
directoryin development
) when a filewas found in merge's remote (vendor/plugins/pluginA
filein master
).
你有冲突,因为GIT中发现了一个目录(vendor/plugins/pluginA
目录中development
),当一个文件在合并的遥控器(被发现vendor/plugins/pluginA
的文件中master
)。
Since it isn't possible to merge a file with a directory, git makes a copy of the master data in vendor/plugins/pluginA~master
(to avoid losing data), and leaves you with a conflict that needs to be resolved manually.
由于不可能将文件与目录合并,因此 git 会在其中复制主数据vendor/plugins/pluginA~master
(以避免丢失数据),并留下需要手动解决的冲突。
Move/rename/delete/copy/edit/whatever those files to get your code to the desired state, then git add
the changes and git commit
the conflict resolution.
移动/重命名/删除/复制/编辑/任何这些文件以使您的代码达到所需状态,然后git add
进行更改和git commit
解决冲突。