How can I identify which branches contain a specific commit?

  1. Using git branch --contains <commit-hash>:

    git branch --contains abc123
    

    This shows all local branches containing the commit.

  2. To include remote branches as well:

    git branch -a --contains abc123
    

Replace abc123 with your actual commit hash. You can use either the full hash or a shortened version (at least 7 characters).

These commands will list all branches that include the specified commit in their history.

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