【问题标题】:git Bug prevents mergegit Bug 阻止合并
【发布时间】:2013-01-19 01:17:02
【问题描述】:

如何在 git 错误上执行 git bisect 或以其他方式恢复我的 git 索引。首先出现错误消息,然后尝试以下修复失败

使用 GIT_MERGE_VERBOSITY=5 我运行 git merge origin master 并得到...

Merging:
9201eee porque no, "not and"
virtual origin
found 2 common ancestors:
21d206e (redo) merged in feature/edb and fixed the unit test. Also fixed a bug in bq where the imposition of the MIN_BUILDINGS constraint results in zero results, but an erroneous 'found_entities' field.
ac55def Merge pull request #276 from company/feature/chromeframe_support
  Merging:
  21d206e (redo) merged in feature/edb and fixed the unit test. Also fixed a bug in bq where the imposition of the MIN_BUILDINGS constraint results in zero results, but an erroneous 'found_entities' field.
  ac55def Merge pull request #276 from company/feature/chromeframe_support
  found 1 common ancestor:
  2f55197 Merge pull request #271 from company/feature/autobahn-host-as-setting
  Auto-merging requirements.unstable.txt
  Auto-merging requirements.txt
  Auto-merging project/tests/test_querier.py
  CONFLICT (content): Merge conflict in project/tests/test_querier.py
  Skipped project/static/project/images/bg-paper.png (merged same as existing)
  Skipped project/static/project/apps/scatter-plot/js/xcharts.custom.js (merged same as existing)
  Skipped edb/models.py (merged same as existing)
  CONFLICT (rename/rename): Rename "edb/migrations.broken/0006_auto__del_field_site_entity_id.py"->"edb/migrations/0012_lengthen_owner_type_and_rating_charfield.py" in branch "Temporary merge branch 1" rename "edb/migrations.broken/0006_auto__del_field_site_entity_id.py"->"edb/migrations/0005_change_site_id_to_site_entity_id.py" in "Temporary merge branch 2" (left unresolved)
  Skipped edb/migrations/0007_rvalue_changed_to_r_value.py (merged same as existing)
  Skipped edb/migrations/0004_regenerate_garbled_field_names_due_to_slashes_in_csv_header_strings.py (merged same as existing)
  Auto-merging BE/templates/base.html
BUG: There are unmerged index entries:
BUG: 1 edb/migrations.broken/0005_auto__add_field_site_id__chg_field_site_entity_id.py
fatal: Bug in merge-recursive.c
  • git reset --hard 不起作用(后续合并仍然失败)。
  • 在任一方向(master -> mybranch 或 mybranch -> weather)合并都会导致相同的 BUG。
  • 工作目录中不存在有问题的文件,但在使用rm -fgit committed 签出master 时删除了master 中的相关空目录(edb/migrations.broken/)(但显然git 没有记录任何更改索引)修复
  • git update-index --force-remove --unmerged --really-refresh --again --remove 不开心

【问题讨论】:

  • 刚刚意识到我在发生此错误的 OSX 机器上有 brew installed 集线器(并且别名 git 指向 hub)。在没有hub 的 linux 机器上,合并是没有错误的。将撤消 OSX 框上的 git=hub 别名并重新测试。

标签: git git-index


【解决方案1】:

hub(github 客户端)别名或已删除路径 migrations.broken 的 .gitignore 可能是 git“错误”的来源。

alias git=git   # or `brew remove hub`
git rm -rf edb/migrations.broken
git commit -am 'delete non-existent path to update git index'
git push origin feature/edb
git pull origin master
git checkout master
git pull origin master
git rm -rf edb/migrations.broken
git commit -am 'delete non-existent path to update git index'
git push origin master
git checkout feature/edb
git merge master
git commit -am 'delete non-existent path to update git index'

这些命令中的许多(所有rm -rf 命令)将导致关于未完成或不存在文件的警告。但不知何故,它消除了由混淆 git index 引起的 BUG。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-18
    • 2022-01-06
    • 2011-10-09
    • 1970-01-01
    • 1970-01-01
    • 2019-07-25
    相关资源
    最近更新 更多