forked from Dieterbe/git-scripts
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-flush
More file actions
Latest commit
executable file
·22 lines (17 loc) · 553 Bytes
/
Copy pathgit-flush
File metadata and controls
executable file
·22 lines (17 loc) · 553 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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