Answer the question
In order to leave comments, you need to log in
How to remove commit history for only one file in a repository?
The repository has a database dump (several tens of MB), every day at one in the morning, automatic dump creation and git add and git push of all changed data are configured, incl. the base dump is filled in, which is convenient as an additional backup, but unfortunately, git does not handle changes to binary data, which is a dump, and as a result, in a few months .git/objects/pack has grown a lot (several GB)
The question is how to remove everything from the commit history commits for this particular dump.db file other than the last one? At the same time, I would like to keep the commit history of the remaining files
Answer the question
In order to leave comments, you need to log in
This can only be done by completely rewriting the entire history: all hashes in all commits and in all branches will be changed . All developers will need to re-check out all the necessary branches.
If that doesn't scare you, then:
git filter-branch --index-filter "git rm --cached --ignore-unmatch файл" HEAD
No way. Generally. A commit is a change in the state of the entire repository. The concepts of files are rather abstract there.
You can only completely delete a file from history.
Option: How to remove a file from the commit history in GIT?
And then upload the latest version again.
I didn't do that, I don't know how true.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question