9

I get a fatal sha1 error. I believe it is stuck trying to write large files. My status says I'm 8 commits ahead. I've tried to add the file extension to an ignore list in the exclude folder but it is still stuck. How do I proceed without losing my local changes (other than the large files)?

I've tried Predict how much data will be pushed in a git push and the bundle is huge ~650MB.

I don't know how to ignore the files from previous commits that were not pushed. Can I clear the old commits without losing the local files? Then delete the large files then commit again?

Community
  • 1
  • 1
dsbmac
  • 101
  • 2
  • 5

1 Answers1

13

From http://git-scm.com/book/en/Git-Tools-Rewriting-History :

Removing a File from Every Commit

This occurs fairly commonly. Someone accidentally commits a huge binary file with a thoughtless git add ., and you want to remove it everywhere. Perhaps you accidentally committed a file that contained a password, and you want to make your project open source. filter-branch is the tool you probably want to use to scrub your entire history. To remove a file named passwords.txt from your entire history, you can use the --tree-filter option to filter-branch:

$ git filter-branch --tree-filter 'rm -f passwords.txt' HEAD

But if it's only last commit you messed up you can solve it with git rm large_file and git commit --amend

Community
  • 1
  • 1
kaman
  • 376
  • 1
  • 8