From 0c0e89b6d68baf97ed208d67865d5428fc6d1a40 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Mon, 30 Sep 2019 15:38:13 +0100 Subject: [PATCH] updated git.sh --- .bash.d/git.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.bash.d/git.sh b/.bash.d/git.sh index 5fc1f79b..eac53b09 100644 --- a/.bash.d/git.sh +++ b/.bash.d/git.sh @@ -55,7 +55,6 @@ alias branch="githg branch" alias br=branch alias tag="githg tag" alias um=updatemodules -alias gitgc="du -sh .git; git gc --aggressive; du -sh .git" alias gbrowse=gitbrowse type browse &>/dev/null || alias browse=gbrowse @@ -71,6 +70,16 @@ alias staging="switchbranch staging" alias stage=staging alias dev="switchbranch dev" +gitgc(){ + if ! [ -d .git ]; then + echo "not at top of a git repo, not .git/ directory found" + return 1 + fi + du -sh .git + git gc --aggressive + du -sh .git +} + gitbrowse(){ browser "$(git remote -v | awk '/https:/{print $2}' | sed 's,://.*@,://,' | head -n1)" }