Skip to content

Instantly share code, notes, and snippets.

@leighklotz
Created September 27, 2023 16:46
Show Gist options
  • Select an option

  • Save leighklotz/4cd927cca73c666037dbb5b509d3a91f to your computer and use it in GitHub Desktop.

Select an option

Save leighklotz/4cd927cca73c666037dbb5b509d3a91f to your computer and use it in GitHub Desktop.
list-branches.sh
#!/bin/bash
for branch in $(git branch | sed -e 's/[*]//')
do
echo -ne "${branch}\tis contained in these branches:\t"
git branch --contains "${branch}" | tr '\n*' ' ' | sed -e "s/\<${branch}\>//"
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment