Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env zsh
- # usage: greview <default_branch>
- # example:
- # git checkout branch_to_review
- # greview master
- base=${1:-master}
- other=$(git rev-parse --abbrev-ref HEAD)
- files=($(git diff --name-only ${base}..${other} | tr '\n' ' ' 2>/dev/null))
- PROMPT3="select [x to exit]: "
- while true; do
- select file in ${files[@]}; do
- case $file in
- *)
- if [[ "${REPLY}" =~ "^[0-9]+$" ]] ; then
- file=${file/% \[x\]/}
- if [ $REPLY -le $#files ] ; then
- git difftool -t vimdiff ${base}..${other} ${file} 2>/dev/null
- files[$REPLY]="${file} [x]"
- fi
- break
- elif [ "${REPLY}" = "x" ] ; then
- echo "done..."
- exit 0
- else
- echo "invalid input: $REPLY, retry"
- fi
- ;;
- esac
- done
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement