I have a git repo that has multiple unmerged branches, and need to get a handle on what is where. SOME of them have had commits cherry-picked across, so if I do a list of commits using the top line of the log message, two of them would show the same text in different branches.
I have used git show-branch to show me all the commits and which branches they are in, and I can see some of them sharing the same text... but I have to first pick a commit msg, then search (or grep) for that text to see if it appears in another branch.
Is there a way to automate this cross referencing of common commits across branches? So that I can get a list of all branches that the commit "this fixes the config problem" is in? Even better would be a list of cherry-picked commits and where their origin commit is, but I am not holding out hope for that. Just a list that shows that commit X appears in branches A, B, and C would be a tremendous help.
git log
has a set of options to detect cherry-picks: see --cherry-mark
and below.
Sample usage:
git log --cherry master...my/branch
git log --cherry-mark master...my/branch
# with more options:
git log --graph --oneline --cherry master...my/branch
git log --graph --oneline --boundaries --cherry-mark master...my/branch
This will compare commits based on their content , so even if the message was edited a cherry-picked commit will be detected. A cherry-pick that led to a conflict will not be detected though (even if the messages are the same).
It will use the same algorithm as what git rebase
uses to determine that a commit is already part of the target branch and shouldn't be replayed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.