[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Savannah-hackers-public] FYI, ran "git gc" on all git repositories

From: Jim Meyering
Subject: [Savannah-hackers-public] FYI, ran "git gc" on all git repositories
Date: Fri, 09 Oct 2009 16:27:32 +0200

I did the same thing a few months ago.
For some it made a big difference: emacs.git went from 1.1GB to 155MB.
Active repositories were shrunk to ~20% or even 5% of their original size.

This is the script I ran:

log=$(mktemp /tmp/log-repo-gc-XXXXXX)
printf "Run this to see more detail:\ntail -f $log\n"
exec >$log

cd /vservers/vcs-noshell/srv/git

for dir in *.git; do
  echo $dir... 1>&2
  start_kb=$(du -sk $dir|cut -f1)
  printf '%-20s %u KiB->' $dir $start_kb
  start_sec=$(date +%s)
  git --git-dir=$dir gc
  end_sec=$(date +%s)
  elapsed=$((end_sec - start_sec))
  end_kb=$(du -sk $dir|cut -f1)
  percent_saved=$(echo "scale=2; 100 * ($start_kb - $end_kb) / $start_kb"|bc)
  printf '%s (saved %s%% in %ss)\n' $end_kb $percent_saved $elapsed

reply via email to

[Prev in Thread] Current Thread [Next in Thread]