new version
[feisty_meow.git] / scripts / rev_control / compact_git.sh
1 #!/bin/bash
2
3 # compresses the git archive in the folder specified.
4
5 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
6 source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh"
7
8 ##############
9
10 prune_dir="$1"
11 if [ -z "$prune_dir" ]; then
12   prune_dir="$(pwd)"
13 fi
14 pushd "$prune_dir" &>/dev/null
15 test_or_die "changing to directory: $prune_dir"
16
17 echo "cleaning git repo in directory $(pwd)"
18
19 git fsck --full
20 test_or_die "git fsck"
21
22 git gc --prune=today --aggressive
23 test_or_die "git gc"
24
25 git repack
26 test_or_die "git repack"
27
28 popd &>/dev/null
29