0

I copied a few hundred megabytes of images from my production environment into my development environment. Even though I have them in .gitignore (public/uploads/) and they are not under version control (I checked with git ls-tree -r master --name-only) my last commit to GitHub was huge (a few hundred megabytes).

I saw that the few hundred megabytes seem to be in the following directory: .git/objects/ in subfolders named from 00 to ff. I can't see the .git directory on GitHub (where I commited to), but since there is the huge amount of data in it I guess it must be the reason for the commit > 100 MB. Can I simply delete the subfolders under .git/objects or how can I get rid of the hunderd MBs of images that I do not want to have under version control?

JJD
  • 50,076
  • 60
  • 203
  • 339
user929062
  • 807
  • 4
  • 12
  • 33
  • See http://stackoverflow.com/questions/2100907/how-do-i-purge-a-huge-file-from-commits-in-git-history – JosefAssad Apr 23 '13 at 14:05
  • You should see the file in the history if it has been committed (try `gitk` or `gitx` for a user-friendly view). The `.git` directory doesn't show up on GitHub. – Fred Foo Apr 23 '13 at 14:19
  • 1
    You could also type _git log --numstat_ on the command line to check wich files where affected by the last commit. Then you can decide what to do (ie. reset the commit or revert the commit). – Daniel Noguchi Apr 23 '13 at 17:19
  • The command `git ls-files` also lists all files tracked in the repository. Can you please describe how you committed and pushed files to GitHub since I suspect the problem there. Alternatively, you can post the address of the repository. – JJD Apr 23 '13 at 22:11
  • Did you git add, but then later add them to the ignore? It's possible you still have unreferenced objects floating around that'd get cleaned by a gc. – Jason Malinowski Apr 23 '13 at 22:33
  • Thanks! Indeed, git log --numstat and git ls-files are convenient! What I did was manually copy the images into the public/uploads folder (using Nautilus), since I also changed some code I also did a "git add ." and a git commit -am "Some changes". When I did "git push origin master" I saw that there are too many files. Anyhow, since I had public/uploads already in my gitignore I'm not sure why git bothered. – user929062 Apr 24 '13 at 09:39

0 Answers0