Created
August 24, 2023 08:41
-
-
Save ex-nerd/343a603b526da7fcb24acab1a2f51b64 to your computer and use it in GitHub Desktop.
Given a file path, it lists all remote branches that have modified that path
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
# | |
# I needed this for something and was surprised that I couldn't find an easy answer elsewhere. | |
# So here it is just in case a search engine picks it up. | |
# | |
# Given a file path, it lists all remote branches that have modified that path | |
# | |
function git_file_branches() { | |
echo -e "date\tbranch\tauthor" | |
for BRANCH in $(git log --remotes --no-merges --not develop --source --decorate=short -- $1 | grep ^commit | cut -f 2 | uniq); do | |
git log -1 --date=format-local:'%Y-%m-%d %H:%M:%S' --pretty=format:"%ad%x09%D%x09%an <%ae>" $BRANCH 2>/dev/null | sort | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment