值得了解这些错误消息的含义 -needs merge
并error: you need to resolve your current index first
表明合并失败,并且这些文件中存在冲突。如果您认为无论您尝试进行的任何合并都是一个坏主意,您都可以通过以下方式使事情恢复正常:
git reset --merge
但是,否则您应该解决这些合并冲突,如 git 手册中所述。
一旦你用任何一种技术处理了这个问题,你应该能够检查9-sign-in-out
分支。正如wRAR 的回答9-sign-in-out
所master
建议的那样,仅将您重命名为的问题是,如果您与任何人共享了以前的 master 分支,这会给他们带来问题,因为如果两个分支的历史不同,您将发布重写历史。
本质上,您想要做的是将您的主题分支合并9-sign-in-out
到master
但完全保留主题分支中的文件版本。您可以通过以下步骤执行此操作:
# Switch to the topic branch:
git checkout 9-sign-in-out
# Create a merge commit, which looks as if it's merging in from master, but is
# actually discarding everything from the master branch and keeping everything
# from 9-sign-in-out:
git merge -s ours master
# Switch back to the master branch:
git checkout master
# Merge the topic branch into master - this should now be a fast-forward
# that leaves you with master exactly as 9-sign-in-out was:
git merge 9-sign-in-out