Languages
[Edit]
EN

Git - delete local branch

6 points
Created by:
ParaEagle
724

In this short article we would like to show how to remove local branch in git.

Run following command:

or

 

Example output:

Notes:

  • do not forget to checkout to other branch from my_branch_name before delete operation - below example shows how to do it,
  • go to this article to know how to remove remote branch.

Removing with force example

Edit

The branch must be fully merged in its upstream branch, or in HEAD if no upstream was set with --track or --set-upstream-to.

Alternatively we can run delete with force, parameter -D

Removing active branch example

Edit

This section shows how to remove branch that we are currently using.

Run:

Example output:

 

Alternative titles

  1. Git - remove local branch
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Git

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join