git branch --contains <commit>

List local branches that include the specified commit.

This command helps you identify which local branches contain a given commit by checking the commit ancestry.

It is useful when you need to determine in which branches a specific change has been merged or applied, allowing you to manage feature branches, hotfixes, or identify redundant branches.

You can also use variations like git branch -r --contains <commit> to search through remote branches, or combine flags such as -a for both local and remote branches, and even use filtering commands like grep to narrow down the results.

Manual page
git branch
Related commands

Welcome to GitExamples!

Sign in to enable bookmarking, reminders, progress-tracking and more...