diff options
-rwxr-xr-x | git-fzf | 23 | ||||
-rwxr-xr-x | git-merge-diff | 11 | ||||
-rwxr-xr-x | git-push-first | 11 |
3 files changed, 45 insertions, 0 deletions
@@ -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 + ' +)" |