From ea5c89fa5f276f9b500fa6afe5880c6bcaddb789 Mon Sep 17 00:00:00 2001 From: Tony Duckles Date: Sun, 17 Nov 2013 10:21:25 -0600 Subject: [PATCH] bin/git-*: Add git-alias, git-obliterate, git-show-tree Adding some new Git utilities from git-extras: https://github.com/visionmedia/git-extras --- bin/git-alias | 9 +++++++++ bin/git-obliterate | 7 +++++++ bin/git-show-tree | 5 +++++ 3 files changed, 21 insertions(+) create mode 100755 bin/git-alias create mode 100755 bin/git-obliterate create mode 100755 bin/git-show-tree diff --git a/bin/git-alias b/bin/git-alias new file mode 100755 index 0000000..f6ad849 --- /dev/null +++ b/bin/git-alias @@ -0,0 +1,9 @@ +#!/bin/sh +# Usage: git-alias [ []] +# Show/add aliases. + +case $# in + 0) git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort ;; + 1) git alias | grep -e "$1" ;; + *) git config --global "alias.$1" "$2" ;; +esac diff --git a/bin/git-obliterate b/bin/git-obliterate new file mode 100755 index 0000000..25765e8 --- /dev/null +++ b/bin/git-obliterate @@ -0,0 +1,7 @@ +#!/bin/sh +# Usage: git-obliterate +# Rewrite repo history to completely remove all traces of a given file/directory. + +file=$1 +test -z $file && echo "file required." 1>&2 && exit 1 +git filter-branch -f --index-filter "git rm -r --cached $file --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all diff --git a/bin/git-show-tree b/bin/git-show-tree new file mode 100755 index 0000000..611e810 --- /dev/null +++ b/bin/git-show-tree @@ -0,0 +1,5 @@ +#!/bin/sh +# Usage: git-show-tree +# Display a tree summarizing the lineage of all branches in the repo. + +git log --all --graph --decorate --oneline --simplify-by-decoration -- 2.47.1