0

I have a GIT repo in which I have two folders which are managed with some GH actions and forwarded to GH pages. The first folder (name it data/) contains compressed historical data collected periodically through GH actions. The second folder (name it docs/) contains the uncompressed data for the latest collection and some additional HTML files which are meant for the GH pages. This second folder is also updated on the same periodicity as the first folder - and in this sense, the contents is fully removed (git rm * and git push) before updating it (tar x followed by git add/commit/push)

Since the uncompressed data is quite large, the GIT repo keeps growing and growing. However, I'm not interested in keeping a history of this second folder - I only want to keep the latest update, so is there any way to remove the history of this second folder to save space?

Harald
  • 3,110
  • 1
  • 24
  • 35
  • 1
    Why not `git filter-repo` on that folder and force push? – matt Feb 01 '23 at 00:30
  • https://stackoverflow.com/a/2158271/7976758 `git rebase`, `git filter-branch`, whatever https://stackoverflow.com/search?q=%5Bgit%5D+remove+large+files+history – phd Feb 01 '23 at 07:40

1 Answers1

1

Not exactly an answer to your question but for me you should change your workflow of publishing the github page as you try to do something that goes against how git is working...

You should put the result of the github page in another branch (for example gh-pages) and publish the github pages from this branch.

And for this gh-pages branch, do not keep history (done with the command git checkout --orphan gh-pages in the following script).

You could do it with a script I provided in this answer.

Adapt the script to publish the docs untracked folder (instead of the dist one), where you will have built your documentation without committing it.

That way, you won't have to rewrite the history because your big folder will never be committed in the main branch.

Settings to change in GitHub project to select the other branch:

github pages setting

Philippe
  • 28,207
  • 6
  • 54
  • 78