3

My Problem:

Early on when the repository was set up a mistake was made causing all the images at the time to be written to the repository. This was quickly rectified in the gitignore file and no longer presents a problem.

The problem is now that we have an enormous repository which contains the history of the images. This presents a problem when cloning the repository locally as it takes a lot longer than a clean clone from the tip.

My questions:

Is there a way of removing the part of the history that includes the images which are never going to be needed?

If I cannot remove can I compress or even cleanup the history in any way?

Imad Alazani
  • 6,688
  • 7
  • 36
  • 58
Andy
  • 631
  • 1
  • 6
  • 13
  • 4
    Checkout [6.4 Git Tools - Rewriting History](http://git-scm.com/book/ch6-4.html), especially the part *The Nuclear Option: filter-branch*. – miku Aug 01 '13 at 09:15
  • 1
    possible duplicate of [New repo with copied history of only currently tracked files](http://stackoverflow.com/questions/17901588/new-repo-with-copied-history-of-only-currently-tracked-files), [Completely remove unwanted file from Git repository history](http://stackoverflow.com/questions/307828/completely-remove-unwanted-file-from-git-repository-history), and [Remove sensitive files and their commits from Git history](http://stackoverflow.com/questions/872565/remove-sensitive-files-and-their-commits-from-git-history/872700#872700). –  Aug 01 '13 at 12:29
  • Thanks @Cupcake, the second link provided part of the answer I needed. – Andy Aug 01 '13 at 12:37

1 Answers1

6

If it is removing part of history - you use git rebase interactive

if it is file removal (from all versions) use git filter-branch

miku
  • 181,842
  • 47
  • 306
  • 310
forvaidya
  • 3,041
  • 3
  • 26
  • 33