首页 > 解决方案 > git:使用来自主错误的最新更改更新当前开发分支

问题描述

我在这里做了一些关于如何使用 master 的最新更改最好地更新当前分支的搜索。

所以我这样做了:

git checkout add_game_monsters && git rebase master

这样做之后,我认为我的分支处于不确定状态,因为我收到了这个错误:

Patch failed at 0001 added game characters 失败的补丁副本位于:.git/rebase-apply/patch

所以我查看了那个补丁文件,它有 8000 行长。

我也不能再更改 Visual Studio 中的分支,因为它们都是灰色的。

我尝试重新启动,但遇到了同样的问题。

我怎样才能解决这个问题?

谢谢!

一个 git 状态显示:

rebase in progress; onto 3cb516c3
You are currently rebasing branch 'add_game_monsters' on '3cb516c3'.
  (fix conflicts and then run "git rebase --continue")


Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add/rm <file>..." as appropriate to mark resolution)

        deleted by them: ../Database/Tables/dbo.gamers.sql
        deleted by them: ../Database/Tables/dbo.monsters.sql

标签: gitvisual-studio

解决方案


解决这种冲突可能需要的不仅仅是表面上的。就像在基础分支上所做的更改(我知道它们是在基础分支上进行的,因为它们在 上被删除add_game_monsters是在变基期间进行的)需要移动到另一个文件?但是如果它们可以像那样被丢弃,你可以这样做:

git rm ../Database/Tables/dbo.gamers.sql
git rm ../Database/Tables/dbo.monsters.sql
git rebase --continue

推荐阅读