summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-fzf23
-rwxr-xr-xgit-merge-diff11
-rwxr-xr-xgit-push-first11
3 files changed, 45 insertions, 0 deletions
diff --git a/git-fzf b/git-fzf
new file mode 100755
index 0000000..9ce46e7
--- /dev/null
+++ b/git-fzf
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if [ "$1" = '--local' ] || [ "$1" = '-l' ]; then
+ shift
+ git_options=''
+ sed_prefix=''
+else
+ git_options='--remote'
+ sed_prefix='origin/'
+fi
+
+git branch ${git_options} 2>/dev/null \
+| sed '
+ s@^..'"${sed_prefix}"'@@
+ t
+ d
+' \
+| fzf \
+| if [ "$#" -gt 0 ]; then
+ xargs -r git "$@"
+else
+ cat
+fi
diff --git a/git-merge-diff b/git-merge-diff
new file mode 100755
index 0000000..ad885de
--- /dev/null
+++ b/git-merge-diff
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+up="$1"
+shift
+[ $# -gt 0 ] \
+&& [ -n "${1%%--*}" ] \
+&& down="$1" \
+&& shift \
+|| down=HEAD
+
+git diff "$(git merge-base "$up" "$down")" "$down" "$@"
diff --git a/git-push-first b/git-push-first
new file mode 100755
index 0000000..26e50f4
--- /dev/null
+++ b/git-push-first
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+eval "$(
+ git push 2>&1 \
+ | sed '
+ $d
+ ' \
+ | sed -n '
+ $p
+ '
+)"