Created
November 7, 2018 23:28
-
-
Save paulscott/0d4dd938e634a505bf1eb985e4b13020 to your computer and use it in GitHub Desktop.
List the local and remote git branches and tags that contain a commit, branch, tag, or object
This file contains hidden or 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 | |
if [ -z "$1" ]; then | |
echo 'usage: git contains <commit|object>' | |
exit 1 | |
fi | |
if [ ! $(git rev-parse --is-inside-work-tree 2>/dev/null) ]; then | |
echo "fatal: Not a git repository" | |
exit 1 | |
fi | |
echo branches: | |
git branch --all --contains "$1" | |
echo tags: | |
git tag --contains "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment