1

I had some unexpectedly large files which I committed and pushed. The git push failed because they were too large.

So I removed them from my local repo directory and then I made a new git add/commit/push and git was still trying to push the same large files so it failed again.

I did a git status and noticed the files were still in the "Changes not staged for commit" lower part of the status report and colored in red. I also noticed they have instructions saying I should "add/remove files to update what will be committed", so I ran a "git rm filename" on the files. As a result of that, I did a new git status and saw the same files in the upper area of the git status report, now in green.

So thinking I had succeeded, I did a new git add/commit/push and this failed again for the same reason: the same files were trying to be pushed and were too large.

So I read up more and tried doing a git rm --cache filename on all the files, but this command failed saying the file did not exist.

Now if I do a git status I no longer see the files I deleted, but if I push it still tries to push the. Could anybody please recommend how to troubleshoot this? I really can't lose my local work.

By the way, I can overwrite the remote with no problem as I am the only one working on it.

Odisseo
  • 747
  • 1
  • 13
  • 32
  • 2
    You can reset your `master` branch to a place before you commited the large files for the first time. This will work as long as none of the pushes has been successful. – Krzysiek Karbowiak Jan 14 '19 at 08:07
  • 1
    I had the same problem, and this suggestion worked, using the info from https://stackoverflow.com/questions/1628088/reset-local-repository-branch-to-be-just-like-remote-repository-head – Chris Sherwood Jan 17 '19 at 17:52

1 Answers1

0

I ended up solving this by simply rolling back to previous commits. Note to future users: if you want to keep your local changes, do not rebase your local repo.

Odisseo
  • 747
  • 1
  • 13
  • 32