1

I have several files that are too big to commit to github and now I am forced to rewrite the history using git filter branch.

I have about 4 files that are above 100MB csv files that I would prefer to just remove from the history. I have files name: story_a002.csv, input_0019.csv, charlet.csv and model_892.csv

I know I am able to use this command below but I must use it one at a time. Once the rewrite is complete I have to push the changes; unfortunately, because I have to rewrite all of them first othewise I will get a File Too Large github issue.

git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch <filename> 

Is there a way to chain this so I can rewrite once and do a single push?

1 Answer 1

4

First, You might consider the new git filter-repo, which will replace the old git filter-branch or BFG.

It has many usage examples, including path-based filtering:

To keep all files except these paths, just add --invert-paths:

git filter-repo --path aFileToRemove --invert-paths 

Try it with multiple path (to remove all your files in one command), and then force push.

Sign up to request clarification or add additional context in comments.

2 Comments

A bit emberassing as I did this weeks ago but I dont recall how to push changes. I was able to rewrite it using a command with multiple paths like this git filter-repo --path system/ftb/logs/homeTest2_log_2020-07-06--21-34-56.csv --path system/ftb/logs/log_boom_1595882264736.csv --path system/ftb/python/logs/log_boom_1598049968926.csv --path system/servo/logs/log_servo_1595882275794.csv --invert-paths however when I try to push my stream is broken. So i reconnect it but a pull is required. How do I push my changes after?
@Potion After a filter repo, you should force push: git push --force (assuming you are the only one working on that branch, or that other colleagues are well aware of that rewrite)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.