git tricks ...
Par MadCoder,
Wednesday 21 February 2007 à 15:04 ::
Geeky
when you have a svn-like use of git (I mean with a central repository), it's a good thing to repack the central repository from time to time. If your repository lives (totally random example) in /git/pkg-xorg/lib/mesa.git, you can do:
cd /git/pkg-xorg/lib/mesa.git && GIT_DIR=. git repack -a -d
I'm told that some people that had more than 1.5Go of git repositories have seen their main repositories shrink well under 200Mo of disk usage. On my own git central server, I use that as a cron:
#! /bin/bash
GIT_BASE=/git
for repo in $GIT_BASE/*.git; do
pushd $repo &>/dev/null
GIT_DIR=. git repack -a -d &>/dev/null
popd $repo &>/dev/null
done
but on a big and loaded server one could make it better and repack only when it seems to be needed and use (untested):
#! /bin/bash GIT_BASE=/git GIT_THRESHOLD=5000
for repo in $GIT_BASE/*.git; do
pushd $repo &>/dev/null
if test $(find objects | cut -d/ -f3 | wc -w) -gt $GIT_THRESHOLD; then
GIT_DIR=. git repack -a -d &>/dev/null
fi
popd $repo &>/dev/null
done

Commentaires
1. Le Wednesday 21 February 2007 à 17:17, par Peter Baumann
2. Le Wednesday 21 February 2007 à 18:28, par MadCoder :: site
3. Le Thursday 22 February 2007 à 10:00, par David
4. Le Thursday 22 February 2007 à 11:21, par MadCoder :: site
Ajouter un commentaire