Skip to content

Instantly share code, notes, and snippets.

@openam
Created February 24, 2015 16:27
Show Gist options
  • Select an option

  • Save openam/bd4ab13ea4a1defc59dc to your computer and use it in GitHub Desktop.

Select an option

Save openam/bd4ab13ea4a1defc59dc to your computer and use it in GitHub Desktop.
Check for commits on one branch that are not in another branch, and export them to the desktop.
#!/bin/bash
if [[ $# -lt 2 ]]; then
echo "
Usage: compare-branches baseBranch compareBranch
Shows what commits exist in the second branch that are not in the first"
exit
fi
FIRST=$1
SECOND=$2
echo "Generating logs in the desktop showing what commits are in branch '${SECOND}' that are not in branch '${FIRST}'"
git log --right-only --cherry-pick --pretty=format:"%H|%an|%s" ${FIRST}...${SECOND} > ~/Desktop/${SECOND}.short.txt
git log --right-only --cherry-pick ${FIRST}...${SECOND} > ~/Desktop/${SECOND}.long.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment