public
Description: A bunch of random scripts I've either written, downloaded or clipped from #git.
Homepage:
Clone URL: git://github.com/jwiegley/git-scripts.git
git-scripts / git-flush
100755 23 lines (17 sloc) 0.553 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
 
# The job of git-flush is to recompactify your repository to be as small
# as possible, by dropping all reflogs, stashes, and other cruft that may
# be bloating your pack files.
 
rm -fr .git/refs/original
if [ -f .git/info/refs ]; then
perl -i -ne 'print unless /refs\/original/;' .git/info/refs
fi
if [ -f .git/packed-refs ]; then
perl -i -ne 'print unless /refs\/original/;' .git/packed-refs
fi
 
git reflog expire --expire=0 --all
 
if [ "$1" = "-f" ]; then
git stash clear
fi
 
git repack -adf #--window=200 --depth=50
git prune