]>
git.wh0rd.org - home.git/blob - .bin/git-rb-all
2 # Helper to rewrite all local branches.
8 printf "${BRACKET}### ${GREEN}${b}${NORMAL}"
9 if ! git config
--local "branch.${b}.merge" >/dev
/null
; then
10 echo " -> skipping due to missing merge branch"
13 git checkout
-q "${b}" ||
return
14 git rebase
"${opts[@]}" | sed -e '/^Fast-forwarded/d' -e "s:^:${BAD}:" -e "s:$:${NORMAL}:"
15 if [[ ${PIPESTATUS[0]} -ne 0 ]] ; then
30 while [[ $# -ne 0 ]] ; do
32 -q|
-v|
-n|
--no-stat|
--stat) opts
+=( "$1" );;
38 [[ -z ${GOOD} ]] && eval "$(bash-colors --env)"
40 # Switch to the top dir in case the working dir doesn't exist in every branch.
41 cd "$(git rev-parse --show-toplevel)" ||
return
43 # Skip if rebase is in progress.
44 if [[ -e $
(git rev-parse
--git-path rebase-merge
) || \
45 -e $
(git rev-parse
--git-path rebase-apply
) ]] ; then
46 printf "${BAD}skipping due to active rebase${NORMAL}\n"
51 orig
=$
(git rev-parse
--abbrev-ref HEAD
) ||
return
53 branches
=( $
(git for-each-ref
--format='%(refname:short)' 'refs/heads/*') )
54 for b
in "${branches[@]}" ; do
55 # If it's a branch in another worktree, ignore it.
56 if [[ $
(git branch
--list "${b}") != "+"* ]] ; then
57 rb_one
"${b}" "${opts[@]}"
61 git checkout
-q "${orig}"