Created
June 2, 2016 00:10
-
-
Save grrowl/335364c18970bdeaeda1772197be68f7 to your computer and use it in GitHub Desktop.
code-review.sh <branch to review> [<base branch>]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEFAULT_BASE="develop" | |
if [ -z "$*" ]; then echo "Usage: code-review.sh [review branch] [case compare branch]"; exit 0; fi | |
REVIEW_BRANCH=$1 | |
BASE_BRANCH=${2-$DEFAULT_BASE} | |
echo "Checking out $REVIEW_BRANCH" | |
git checkout $REVIEW_BRANCH || { echo '! Checkout failed' ; exit 1; } | |
echo "Opening branch in $EDITOR" | |
$($EDITOR -n .) | |
echo "Opening changed files" | |
# filter: Added Copied Deleted Modified Renamed Typechanged Unmerged XUnknown Brokenpair | |
# This will also display files which were previously added or modified but now are deleted | |
git diff --name-only HEAD $(git merge-base HEAD $BASE_BRANCH) --diff-filter=ACMRXB | xargs $EDITOR || { echo '! Opening files failed' ; exit 1; } | |
echo "Opening the changelog in commit order" | |
git log HEAD ^$BASE_BRANCH --reverse --no-merges --format=short | $EDITOR & | |
git diff-tree --name-only HEAD $(git merge-base HEAD $BASE_BRANCH) --diff-filter=ACMRXB | xargs $EDITOR || { echo '! Opening changelog failed' ; exit 1; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment