简体   繁体   English

删除无效的git-subtree-split哈希

[英]Removing invalid git-subtree-split hash

I'm having an issue with a subtree in our repository. 我的存储库中的子树有问题。 I can pull just fine, but when trying to push it chugs along and finally shows me this: 我可以拉得很好,但是当试图推动它时,它最终向我展示了这一点:

fatal: bad object 9775d8fba16f51e14cba873f78129d3d166f5888

I did some searching in my .git folder and found this: 我在.git文件夹中进行了搜索,发现了这一点:

.git/subtree-cache/81555/549ffeaa00e89a145f24ccdb0735c07d8d84b2ff
1:9775d8fba16f51e14cba873f78129d3d166f5888

Commit 549ffeaa00e89a145f24ccdb0735c07d8d84b2ff is an older commit where I did a pull of the subtree. 提交549ffeaa00e89a145f24ccdb0735c07d8d84b2ff是一个较旧的提交,其中我提取了子树。 The pull was a squash (as is the preference on the project) and had no issues at the time. 拉力是壁球(对项目的偏好也是如此),当时没有问题。

Looking at the commit itself I see this: 查看提交本身,我看到以下内容:

git-subtree-split: 9775d8fba16f51e14cba873f78129d3d166f5888

Which is that bad object causing me issues. 那是导致我出问题的那个坏物体。 This is the only reference to this hash I can find. 这是我可以找到的对此哈希的唯一参考。 git show 9775d8fba16f51e14cba873f78129d3d166f5888 reports bad object and searching the .git folder shows only the commit above. git show 9775d8fba16f51e14cba873f78129d3d166f5888报告错误对象,搜索.git文件夹仅显示上面的提交。 So it appears to me that this is the only place where the hash is recorded. 因此在我看来,这是唯一记录哈希值的地方。

Is there any way to cull this reference out in some way to enable me to push again? 有什么办法可以某种方式剔除该参考文献,使我能够再次推动? I've tried cleaning the repo, re-cloning, deleting the subtree out of my repo and re-pulling it. 我试过清理存储库,重新克隆,从存储库中删除子树,然后将其重新拉出。 Nothing seems to remove the reference so I'm guessing there's a deeper issue going on here. 似乎没有什么可以删除参考,所以我猜这里有一个更深层次的问题。

I eventually figured out a way to resolve this error. 我最终想出了一种解决此错误的方法。 It might be slightly roundabout but it did the trick: 可能有点回旋处,但确实成功了:

  1. I did a new git subtree split with the --ignore-joins and --rejoin options. 我用--ignore-joins--rejoin选项git subtree split了一个新的git subtree split
  2. I pushed my subtree to a new branch on the remote. 我将子树推到遥控器上的新分支。
  3. I merged the master branch of the remote into my new branch. 我将遥控器的主分支合并到新分支中。
  4. I merged the new branch back into master. 我将新分支合并回master。
  5. I pulled the subtree back into my app project. 我把子树拉回到我的应用程序项目中。

This seems to have resolved the issue by creating a "new" subtree in the app that doesn't contain the commit with the invalid references. 通过在应用程序中创建一个不包含带有无效引用的提交的“新”子树,这似乎已经解决了该问题。

Hopefully if someone else sees the same issue, this might help them out. 希望其他人也遇到同样的问题,这可能会帮助他们。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM