Forrest logo
back to the git tool

git-branch:tldr:7c6d4

git-branch: Delete a local branch (must not have it checked out to do this).
$ git branch -d ${branch_name}
try on your machine

The command git branch -d ${branch_name} is used to delete a branch in Git. Here is the explanation of each part of the command:

  • git: It refers to the Git command-line tool.
  • branch: It is a subcommand in Git used to manage branches.
  • -d: It is an option used with the branch subcommand to delete a branch.
  • ${branch_name}: It is a placeholder that represents the name of the branch you want to delete. You need to replace ${branch_name} with the actual name of the branch when using the command.

For example, if you have a branch named "my-feature-branch" that you want to delete, you would execute git branch -d my-feature-branch.

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