Forrest logo
back to the git tool

git-branch:tldr:10939

git-branch: List which branches include a specific Git commit in their history.
$ git branch --all --contains ${commit_hash}
try on your machine

The command "git branch --all --contains ${commit_hash}" is used to list all branches in a Git repository that contain a specific commit.

Here is an explanation of each part of the command:

  • "git branch" is the command to manage branches in Git.
  • "--all" is an option to display both local and remote branches.
  • "--contains" is an option to filter branches that contain a specific commit.
  • "${commit_hash}" is the placeholder for the actual hash of the commit you want to check.

When you run this command, Git will list all branches (both local and remote) that contain the specified commit. This can be useful to check which branches have integrated or diverged from a specific commit.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the git tool