合并时 Git add 失败
我有两个分支,我喜欢合并“A”和“B”。所以我做了以下操作
git checkout A
git checkout -b AB
git merge B
“否,我在文件 TestSequenceSchemaTest.cs 中存在冲突”,我也使用 TortoiseMerge 解决了该冲突。在“解决完成”之后,我做了一个 git status
schoetbi@P02016097 /s/sara_git ((24a2cd5...)|REBASE)
$ git status
# Not currently on any branch.
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: SARA.sln
# modified: src/Module.TestProgramAdmin/SARA.Modules.TPA.IpoFile.Test/Sara.Modules.TPA.IpoFile.Test.csproj
# modified: src/Module.TestProgramAdmin/Sara.Modules.TPA.IpoFile.Test/Sara.Modules.TPA.IpoFile.Test.csproj
# modified: src/Module.TestProgramAdmin/Sara.Modules.TPA.IpoFile.Test/TestSequenceSchemaTest.cs
# renamed: src/Platform.RT/Sara.Platform.RT.Components/MediatorComponent/SequenceGeneratorXml.cs.orig -> src/Pl
atform.RT/Sara.Platform.RT.Components/MediatorComponent/SequenceGeneratorXml.cs
#
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: src/Module.TestProgramAdmin/SARA.Modules.TPA.IpoFile.Test/TestSequenceSchemaTest.cs
#
现在我尝试了 git add
git add src/Module.TestProgramAdmin/SARA.Modules.TPA.IpoFile.Test/TestSequenceSchemaTest.cs
但现在文件仍保留在“都修改了:”部分。我现在能做什么?
I have two branches that I like to merge "A" and "B". So I did the following
git checkout A
git checkout -b AB
git merge B
No I have a conflict in file TestSequenceSchemaTest.cs that I also resolved using TortoiseMerge. After "Resolve Finished" I made a git status
schoetbi@P02016097 /s/sara_git ((24a2cd5...)|REBASE)
$ git status
# Not currently on any branch.
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: SARA.sln
# modified: src/Module.TestProgramAdmin/SARA.Modules.TPA.IpoFile.Test/Sara.Modules.TPA.IpoFile.Test.csproj
# modified: src/Module.TestProgramAdmin/Sara.Modules.TPA.IpoFile.Test/Sara.Modules.TPA.IpoFile.Test.csproj
# modified: src/Module.TestProgramAdmin/Sara.Modules.TPA.IpoFile.Test/TestSequenceSchemaTest.cs
# renamed: src/Platform.RT/Sara.Platform.RT.Components/MediatorComponent/SequenceGeneratorXml.cs.orig -> src/Pl
atform.RT/Sara.Platform.RT.Components/MediatorComponent/SequenceGeneratorXml.cs
#
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: src/Module.TestProgramAdmin/SARA.Modules.TPA.IpoFile.Test/TestSequenceSchemaTest.cs
#
Now I tried git add
git add src/Module.TestProgramAdmin/SARA.Modules.TPA.IpoFile.Test/TestSequenceSchemaTest.cs
But now the file stays still in the "both modified:" section. What can I do now?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
认为不完全需要,但是,您确定您对分支进行了 git checkout 吗?正如 git status 所示,您
当前不在任何分支
。您可能正在进行一些未中止的变基(如 git bash 提示符所示 -(24a2cd5...)|REBASE
)。让您的工作目录处于正确的状态,然后尝试合并。虽然合并和添加也应该在分离的头状态下工作,但我没有看到任何其他可能的问题。Thought not exactly required, but, are you sure you did the
git checkout
to a branch? As the git status says, you areNot currently on any branch
. You were probably in middle of some rebase which you did not abort ( as indicated by the git bash prompt -(24a2cd5...)|REBASE
). Get your working directory to a proper state and then try the merge. While the merge and add should work in a detatched head state too, I don't see any other possible problems.