Created
May 21, 2018 04:32
-
-
Save sinelaw/bdb7e4c1cc3fdbe7946f32fce1e43f71 to your computer and use it in GitHub Desktop.
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 | |
set -eu | |
BRANCH_A="$1" | |
shift | |
BRANCH_B="$1" | |
shift | |
PATHS="$@" | |
BRANCH_A_COMMITS=$(mktemp) | |
ONLY_IN_BRANCH_A=$(mktemp) | |
BRANCH_B_COMMITS=$(mktemp) | |
ONLY_IN_BRANCH_B=$(mktemp) | |
git log --format="%s" ${BRANCH_A} -- ${PATHS} > ${BRANCH_A_COMMITS} | |
git log --format="%s" ${BRANCH_B} -- ${PATHS} > ${BRANCH_B_COMMITS} | |
if grep -vFf "${BRANCH_B_COMMITS}" "${BRANCH_A_COMMITS}" > ${ONLY_IN_BRANCH_A} ; | |
then | |
echo "Only in ${BRANCH_A}:" | |
git log --format="%h %an: %s" ${BRANCH_A} | grep -Ff ${ONLY_IN_BRANCH_A} | |
fi | |
if grep -vFf "${BRANCH_A_COMMITS}" "${BRANCH_B_COMMITS}" > ${ONLY_IN_BRANCH_B} ; | |
then | |
echo "Only in ${BRANCH_B}:" | |
git log --format="%h %an: %s" ${BRANCH_B} | grep -Ff ${ONLY_IN_BRANCH_B} | |
fi | |
rm ${ONLY_IN_BRANCH_B} | |
rm ${BRANCH_B_COMMITS} | |
rm ${ONLY_IN_BRANCH_A} | |
rm ${BRANCH_A_COMMITS} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment