Skip to content

Instantly share code, notes, and snippets.

@dxc04
Created June 3, 2020 08:36
Show Gist options
  • Save dxc04/8e55fbefa8fe231b55bddf5692e98c17 to your computer and use it in GitHub Desktop.
Save dxc04/8e55fbefa8fe231b55bddf5692e98c17 to your computer and use it in GitHub Desktop.
checks if the branch was already merged
wasMerged1=$(git branch -r --merged ${origin} | grep ${tomerge} | wc -l)
wasMerged2=$(git log --oneline ${origin}..${tomerge} 2> /dev/null | wc -l)
if [[ "$wasMerged1" -gt 0 && "$wasMerged2" -gt 0 ]]; then
echo "It was merged!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment