bin: git-rebase-all
This commit is contained in:
parent
987610a3b4
commit
14f7b4425f
1 changed files with 23 additions and 0 deletions
23
bin/git-rebase-all
Executable file
23
bin/git-rebase-all
Executable file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
export USAGE='[<base>]'
|
||||||
|
|
||||||
|
# This is the recommended pattern from `man git-sh-setup`.
|
||||||
|
#
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
. "$(git --exec-path)/git-sh-setup"
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
case "$#" in
|
||||||
|
0)
|
||||||
|
base=$(git remote show origin | grep "HEAD branch" | awk '{ print $3 }')
|
||||||
|
;;
|
||||||
|
1)
|
||||||
|
base="$1"
|
||||||
|
;;
|
||||||
|
*) usage ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
git branch --list --format='%(refname:short)' \
|
||||||
|
| xargs --verbose -n 1 git rebase "${base}"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue