使用git filter-repo重写历史记录时如何保持提交哈希不变 [英] How to keep commit hashs not change when use git filter-repo rewrite the history

查看:114
本文介绍了使用git filter-repo重写历史记录时如何保持提交哈希不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个git repo,其中有一些无效的文件夹以及已提交和删除的源.我想通过 git filter-repo 重写历史记录.重写时是否可以使提交哈希保持不变.

I have a git repo which has some invalid folder and source committed and deleted. I want to rewrite the history by git filter-repo. Is it possible to keep the commit hash not changing when doing rewrite.

推荐答案

否,这是不可能的.哈希是使用已提交文件的内容计算的.由于您要删除某些内容,因此哈希将有所不同.

No, it's not possible. The hash is calculated using the content of the committed files. Since you are removing some of the content, the hash will be different.

这篇关于使用git filter-repo重写历史记录时如何保持提交哈希不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆