简体   繁体   English

使用 git filter-repo 重写历史时如何保持提交哈希不变

[英]How to keep commit hashs not change when use git filter-repo rewrite the history

I have a git repo which has some invalid folder and source committed and deleted.我有一个 git 存储库,其中包含一些无效的文件夹和源已提交和删除。 I want to rewrite the history by git filter-repo .我想用git filter-repo改写历史。 Is it possible to keep the commit hash not changing when doing rewrite.重写时是否可以保持提交 hash 不变。

No, it's not possible.不,这是不可能的。 The hash is calculated using the content of the committed files. hash 是使用提交文件的内容计算的。 Since you are removing some of the content, the hash will be different.由于您要删除一些内容,因此 hash 会有所不同。

No, this answer gives more detail but basically a commit hash is based the changes made.不, 这个答案提供了更多细节,但基本上提交 hash 是基于所做的更改。 If the changes change then so will the commit hash.如果更改发生变化,那么提交 hash 也会发生变化。

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

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