1

I have following reflogs:

7f85cf4 (HEAD) HEAD@{0}: rebase -i (start): checkout 7f85cf4
84971f1 (origin/master) HEAD@{1}: checkout: moving from 8d8b5af4e7284b6295544fb466062c50518edac6 to 84971f15edf8694e18ec3d7122cdf3a620db80ba
8d8b5af HEAD@{2}: checkout: moving from ea2dff6cddfa5099cf024e333013ee6864263cbb to 8d8b5af4e7284b6295544fb466062c50518edac6
ea2dff6 HEAD@{3}: commit: delete gaussian stats
8d8b5af HEAD@{4}: commit (amend): modify parser and transaction_bytes stat in ramulator
ab7a22f HEAD@{5}: reset: moving to ab7a22f
7bc22ad HEAD@{6}: commit: modify transaction byte and parser
ab7a22f HEAD@{7}: reset: moving to ab7a22f
7f85cf4 (HEAD) HEAD@{8}: commit: delete gaussian
08d0afa HEAD@{9}: commit: delete ramulator stats
ab7a22f HEAD@{10}: reset: moving to ab7a22f
84971f1 (origin/master) HEAD@{11}: checkout: moving from master to 84971f15edf8694e18ec3d7122cdf3a620db80ba
f719a7b (master) HEAD@{12}: commit: ignore ramulator stat
ab7a22f HEAD@{13}: commit: modify parser and transaction_bytes stat in ramulator
84971f1 (origin/master) HEAD@{14}: commit: set HBM envrionment (want to go here)
b1d9828 HEAD@{15}: commit: add PCM source code
09be036 HEAD@{16}: commit: modify gddr5 spec

The thing that I want to do is that go to 84971f1, and remove all histories after it (from ab7a22f).

This is because there was a commit including files that exceed the capacity limit.

I tried using git rm --cached and amend command.

However, even though I used these commands, pushing commits after these commands gives me an capacity limit errors.

How to solve this problem?

sungjun cho
  • 809
  • 7
  • 18
  • See https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository – ElpieKay Jan 13 '20 at 03:43

1 Answers1

2

In addition of "How to remove/delete a large file from commit history in Git repository?", the best practice is to use the new tool git filter-repo which replaces BFG and git filter-branch.

git filter-repo --strip-blobs-bigger-than 1M --refs 84971f1..master

Make sure those large files were not needed in your repo history.

The --refs is what allows you do to Partial history rewrites.

Note: if you get the following error message when running the above-mentioned commands:

Error: need a version of `git` whose `diff-tree` command has the `--combined-all-paths` option`

it means you have to update git.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250