[英]How to delete history of commits inside a git submodule?
I have a git project (with source files = markdown files published with hugo) with a submodule (linked to a "public/" folder, and containing only some generated files (that are then published to github pages through a dedicated github project)).我有一个带有子模块(链接到“public/”文件夹,并且只包含一些生成的文件(然后通过专用 github 项目发布到 github 页面))的 git 项目(源文件 = 用 Hugo 发布的 markdown 文件)) .
HOME :
.git/
.gitmodules
content/
public/ -> linked to a submodule (no .git folder)
Submodule has been added through git submodule add -b slides <URL> public
(per : https://gohugo.io/hosting-and-deployment/hosting-on-github/ )子模块已通过
git submodule add -b slides <URL> public
(每: https : //gohugo.io/hosting-and-deployment/hosting-on-github/ )
Everything is working fine (i can commit and push source files and/or auto-generated files separately).一切正常(我可以分别提交和推送源文件和/或自动生成的文件)。
But i have a growing commit history for the content of the submodule folder (published in a dedicated project).但是我对子模块文件夹(在专用项目中发布)的内容有越来越多的提交历史记录。 Moreover this is 100% useless (being autogenerated all the time).
此外,这是 100% 无用的(一直自动生成)。
So is there a way to easily remove all these commits from the submodule, and only from it ?那么有没有一种方法可以轻松地从子模块中删除所有这些提交,并且只能从它中删除?
The submodule is a local clone of the target repo.子模块是目标 repo 的本地克隆。
Its git database is stored under .git/modules/<modulename>
(instead of a .git
directory under public/
).它的 git 数据库存储在
.git/modules/<modulename>
(而不是public/
下的.git
目录)。
So :所以 :
git subtree
for example)git subtree
) All in all, I'm not sure if 2. or 3. are worth the effort in your situation.总而言之,我不确定 2. 或 3. 在您的情况下是否值得付出努力。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.