1

I am having "File size limit of 100.00" in previous commit due to one file. I do not want to upload this zip file but now is commited in local and it is 2 commits before the one I am now.

Everytime that I am trying to push the new commits it shown me the error again, because it is trying to push the previous ones as well.

The stack it is the following:

Commits

Commit1 (Actual)
Commit2
f0ce53a
Commit3
  ...

The zip file is in f0ce53a, also in this commit there are some changes that I want to push them.

There is any way to push the commit f0ce53a without the zip file?

Thank you so much, if you need any further information let me know.

Eironeia
  • 771
  • 8
  • 20
  • 1
    Possible duplicate of [How to remove/delete a large file from commit history in Git repository?](https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository) – phd Mar 28 '18 at 12:45

1 Answers1

2

One way to fix the problem is an interactive rebase (see here for documentation):

git rebase -i Commit3

You'll get an editable text file that looks like this:

pick f0ce53a Add a big pesky zip file and some other stuff
pick Commit2 Misc. changes
pick Commit1 Misc. changes

There will be some helpful commented lines at the bottom of the file listing the various possible commands. The ones we care about are pick, which means the commit should be used as is, and edit, which will stop the rebase at the given commit to allow us to amend it.

f0ce53a is the commit where the zip file was added so we'll change pick to edit on that line, leaving us with:

edit f0ce53a Add a big pesky zip file and some other stuff
pick Commit2 Misc. changes
pick Commit1 Misc. changes

Save the file and quit (vim: :x), and you'll be on the problem commit. Remove the zip file and amend the commit, then continue the rebase:

git rm foo.zip
git commit --amend
git rebase --continue

You've rewritten history as though the zip file was never committed.

mzulch
  • 1,460
  • 12
  • 14
  • Tons of thank you for the answer seems everything is working fine, but I am in last step and I am receiving that: foo.zip: needs update You must edit all merge conflicts and then mark them as resolved using git add – Eironeia Mar 28 '18 at 08:53
  • @Eironeia just delete (or move) the zip in your file system – Timothy Truckle Mar 28 '18 at 08:58
  • Solved, tons of thanks for such a good answer. Everything already pushed! – Eironeia Mar 28 '18 at 09:02