3

I had accidentally added a large 20mb file to git, and I did an -ammend and removed the file.

Before doing a git push origin master, I want to make sure the file was removed.

I tried doing a git push origin master, and it was taking a long time and the transfer reached like 7mb so I figured the large file is still in the history somewhere.

How can I figure out if the large file is in git's repo history?

Blankman
  • 259,732
  • 324
  • 769
  • 1,199
  • No, it just says 'your branch is ahead of 'origin/master' by 5 commits. – Blankman May 31 '11 at 16:08
  • possible duplicate of [How to purge a huge file from commits history in Git?](http://stackoverflow.com/questions/2100907/how-to-purge-a-huge-file-from-commits-history-in-git) – Karl Bielefeldt May 31 '11 at 16:24

2 Answers2

8

You could see a diff with:

git diff origin/master

Or you could get the information by each commit with:

git whatchanged -p -5

The -p outputs the diff and the -5 means show the last 5 commits, since you are 5 ahead. Alternatively

git whatchanged -5

does the same thing, but instead of showing the diff, shows the files that are changed and the before and after hashes for the file.

Abizern
  • 146,289
  • 39
  • 203
  • 257
3

You can use

$ git log origin/master..

to see the commit messages for everything in your current branch (probably master) that's not in origin/master.

mipadi
  • 398,885
  • 90
  • 523
  • 479
  • 1
    ... and the OP should probably add `--stat` so they can see if the file was added or deleted in any of those commits. – Mark Longair May 31 '11 at 16:12
  • Ok in 2 seperate local commits, I have this very large file (one at the root and one in a folder). How can I delete these permanently so that other developers won't have to download 50mb of files! – Blankman May 31 '11 at 16:17
  • 1
    @Blankman: You probably want to ask that in a separate question. – Andrew Aylett May 31 '11 at 16:19