mfrb 577 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. #
  3. # mfrb
  4. #
  5. # Do "git rebase -i" against the repo's "target" branch
  6. #
  7. MFINFO=$(mfinfo "$@") || exit 1
  8. IFS=' ' read -a INFO <<< "$MFINFO"
  9. TARG=${INFO[3]}
  10. CURR=${INFO[5]}
  11. IND=6
  12. while [ $IND -lt ${#INFO[@]} ]; do
  13. ARG=${INFO[$IND]}
  14. case "$ARG" in
  15. -q|--quick ) QUICK=1 ;;
  16. -h|--help ) USAGE=1 ;;
  17. * ) USAGE=1 ; echo "unknown option: $ARG" ;;
  18. esac
  19. let IND+=1
  20. done
  21. [[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2]" 1>&2 ; exit 1 ; }
  22. [[ $QUICK ]] || git fetch upstream
  23. git rebase upstream/$TARG && git rebase -i upstream/$TARG