2

We have a repo that kept some of it's static media files outside of the repo, and one of our juniors was tasked with moving used files into the repo so we could do static file handling. The problem is that he wasn't very diligent and dropped the entire folder into the repo, rather than cherry picking the files we needed.

How can we search for references to the media files, display a list of files that has no reference in history and purge them from the repo completely?

Kit Sunde
  • 35,972
  • 25
  • 125
  • 179
  • Do you really need to check references in the past that are no longer used? I mean, I would just throw out all the files that are not needed right now. What am I missing? – Randall Cook Jan 31 '13 at 21:14
  • @RandallCook That's a good point, they weren't added so long ago that we would have a lot of changes to the static files. You're right. – Kit Sunde Jan 31 '13 at 21:22
  • Cool. In situations like this, I often keep a directory in the project (also under git) called "archive" or "experimental" to hold files that are not currently needed but that I don't quite want to lose. If the files in question aren't too big, this might work for you. – Randall Cook Jan 31 '13 at 21:25

1 Answers1

0

"they weren't added so long ago"

One solution would be to:

  • reset the branch to before that "dump" of files
  • add only the right files (and commit)
  • cherry-pick the more recent commits made after the dump
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Ah sorry by "so long ago" I actually mean ~2 months ago, there's plenty of code changes, but media changes at a much slower pace. – Kit Sunde Feb 01 '13 at 04:46
  • @KitSunde my answer still stands: you can easily cherry-pick a lot of commits (a range of commits, in fact: http://stackoverflow.com/a/1994491/6309) – VonC Feb 01 '13 at 06:58