You find a bug, and you find the commit that introduced the bug. Now you need to find which release branches are affected.
Looking for the commit sha probably won’t work; cherry-picking or rebasing changes the sha. What will work is searching for the commit message:
git log \ --all \ # log commits on all branches --grep="My commit message!" \ # search for a commit message --format="%H" # print just commit sha
This will print out a list of commit shas:
To print the branches containing these commits, use
git log --all --grep="My commit message!" --format="%H" |\ xargs \ # pipe each line of stdin to command git branch \ # for each line, run git branch --all \ # all branches, including remote --list "*/releases/*" \ # filter to release branches only --contains # containing the commit sha
Now you know which branches need the hotfix you just cooked up!