Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keeping certain numbers of commits in history using git

Tags:

git

I have one repository where a lot of large binary files live. Is it possibly set git to make it keep only last n number of commits? Such as i only want to keep last 5 copies of files in this repository history? But i would very like to not do this manually every 5 commits?

like image 318
Hamza Yerlikaya Avatar asked Dec 08 '09 21:12

Hamza Yerlikaya


1 Answers

The only way to do that is to periodically rewrite the repository.

A commit contains a hash of the commit meta data, the commit info, the commit's parent(s) and the tree you're committing. It's not possible to change something in the past without affecting the present.

like image 61
Dustin Avatar answered Sep 20 '22 22:09

Dustin