From 323cfedcc75e3342aad5ccd976249311b4bb37d7 Mon Sep 17 00:00:00 2001 From: David Celis Date: Thu, 30 Nov 2017 20:53:37 +0000 Subject: [PATCH] Rename git-if and git-ib, add git-li Signed-off-by: David Celis --- local/bin/git-ai | 16 ++++++++++++++++ local/bin/git-bi | 32 ++++++++++++++++++++++++++++++++ local/bin/git-ib | 32 -------------------------------- local/bin/git-if | 16 ---------------- local/bin/git-li | 13 +++++++++++++ 5 file(s) changed, 61 insertion(s)(+), 48 deletion(s)(-) diff --git a/local/bin/git-ai b/local/bin/git-ai new file mode 100644 --- /dev/null +++ b/local/bin/git-ai @@ -0,0 +1,16 @@ +#!/bin/sh + +toplevel=`git rev-parse --show-toplevel` + +command=${1:-add} + +git status --short \ + | fzf \ + --ansi \ + --multi \ + --header "git $command" \ + --preview \ + "echo {} | awk '{print \"$toplevel/\", \$2}' | xargs git diff --color" \ + --reverse \ + | awk "{print \"$toplevel\", \$2}" \ + | xargs git $command diff --git a/local/bin/git-bi b/local/bin/git-bi new file mode 100644 --- /dev/null +++ b/local/bin/git-bi @@ -0,0 +1,32 @@ +#!/bin/sh + +case $1 in + -a) + heads=refs/heads + remotes=refs/remotes + shift + ;; + -r) + remotes=refs/remotes + shift + ;; + *) + heads=refs/heads + ;; +esac + +command=${1:-checkout} +shift + +git for-each-ref \ + --format='%(refname:short) %(color:yellow)(%(committerdate:relative))%(color:reset)' \ + --sort=-committerdate \ + $heads $remotes \ + | fzf \ + --ansi \ + --header "git $command $@" \ + --multi \ + --preview 'git log --patch --color {1}...{1}~5' \ + --reverse \ + | awk '{gsub(/.*\//, ""); print $1}' \ + | xargs git $command $@ diff --git a/local/bin/git-ib b/local/bin/git-ib deleted file mode 100644 --- a/local/bin/git-ib +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -case $1 in - -a) - heads=refs/heads - remotes=refs/remotes - shift - ;; - -r) - remotes=refs/remotes - shift - ;; - *) - heads=refs/heads - ;; -esac - -command=${1:-checkout} -shift - -git for-each-ref \ - --format='%(refname:short) %(color:yellow)(%(committerdate:relative))%(color:reset)' \ - --sort=-committerdate \ - $heads $remotes \ - | fzf \ - --ansi \ - --header "git $command $@" \ - --multi \ - --preview 'git log --patch --color {1}...{1}~5' \ - --reverse \ - | awk '{gsub(/.*\//, ""); print $1}' \ - | xargs git $command $@ diff --git a/local/bin/git-if b/local/bin/git-if deleted file mode 100644 --- a/local/bin/git-if +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -toplevel=`git rev-parse --show-toplevel` - -command=${1:-add} - -git status --short \ - | fzf \ - --ansi \ - --multi \ - --header "git $command" \ - --preview \ - "echo {} | awk '{print \"$toplevel/\", \$2}' | xargs git diff --color" \ - --reverse \ - | awk "{print \"$toplevel\", \$2}" \ - | xargs git $command diff --git a/local/bin/git-li b/local/bin/git-li new file mode 100644 --- /dev/null +++ b/local/bin/git-li @@ -0,0 +1,13 @@ +#!/bin/sh + +command=${1:-show} + +git l \ + | fzf \ + --ansi \ + --multi \ + --header "git $command" \ + --preview \ + "git show {1} --color" \ + --reverse \ + | xargs git $command -- tangled.sh