summaryrefslogtreecommitdiff
path: root/git-fzf.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2022-01-08 11:28:17 +0100
committerErich Eckner <git@eckner.net>2022-01-08 11:28:17 +0100
commit903c75a4c28e27879fc0715b2f36e2990eff6aa9 (patch)
tree68ce36feed9537371216e487dfcf70b6f6348af9 /git-fzf.in
parentf97e9d6b37203d94cd34c64c099f401b154ec868 (diff)
downloadeven-more-utils-903c75a4c28e27879fc0715b2f36e2990eff6aa9.tar.xz
fix names
Diffstat (limited to 'git-fzf.in')
-rwxr-xr-xgit-fzf.in23
1 files changed, 23 insertions, 0 deletions
diff --git a/git-fzf.in b/git-fzf.in
new file mode 100755
index 0000000..9ce46e7
--- /dev/null
+++ b/git-fzf.in
@@ -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