Schedule a cron job to cleanup unnecessary files and optimize the git repository using git-gc








git gc command can be used to optimize the git repository by cleaning up the unnecessary files. The optimization takes some time. We can schedule a cron job to run it:
crontab -e
and schedule the jobs like below:
0 1 * * * cd /path/to/git/Proj1.git; git gc --aggressive
0 2 * * * cd /path/to/git/Proj2.git; git gc --aggressive
the two lines above optimize the two git repositories Proj1.git and Proj2.git at 0am and 1am everyday.

See also

  1. Migrate a cvs repository to a git bare repository
  2. CVS to git Transition Guide
  3. Git Book - Set up a public repository
  4. Git Book - Set up a private repository







No comments:

Post a Comment