合并时 Git add 失败

发布于 2025-01-02 01:26:41 字数 1423 浏览 0 评论 0原文

我有两个分支,我喜欢合并“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九歌凝 2025-01-09 01:26:41

认为不完全需要,但是,您确定您对分支进行了 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 are Not 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文