Junio asked for a 'git gc' utility which users can execute on a regular basis to perform basic repository actions such as: * pack-refs --prune * reflog expire * repack -a -d * prune * rerere gc So here is a command which does exactly that. The parameters fed to reflog's expire subcommand can be chosen by the user by setting configuration options in .git/config (or ~/.gitconfig), as users may want different expiration windows for each repository but shouldn't be bothered to remember what they are all of the time. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
16 lines
262 B
Bash
Executable File
16 lines
262 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2006, Shawn O. Pearce
|
|
#
|
|
# Cleanup unreachable files and optimize the repository.
|
|
|
|
USAGE=''
|
|
SUBDIRECTORY_OK=Yes
|
|
. git-sh-setup
|
|
|
|
git-pack-refs --prune &&
|
|
git-reflog expire --all &&
|
|
git-repack -a -d &&
|
|
git-prune &&
|
|
git-rerere gc || exit
|