Home>Article>Development Tools> How to delete a Git branch

How to delete a Git branch

藏色散人
藏色散人 Original
2018-11-21 15:17:34 19819browse

This article mainly introduceshow to delete Git branches.

Creation of Git branchesandSwitching of Git brancheshave been introduced to you in detail in our previous articles, and they are very simple and easy to understand.

When we no longer need a branch, we want to delete it. How to do it?

Command statement to delete Git branch:

git branch -d + 分支名

Let’s give you the actual operation through a simple example:

First we specify the file folder, enter the Git command line interface, view the branch through git branch and create a branch, as shown in the figure below, we create a tp5 branch.

How to delete a Git branchThere are two branches 5.1 and tp5 at this time, and the current location is under the 5.1 branch.

Then we switch to the tp5 branch through git checkout.

How to delete a Git branch

If we want to delete the 5.1 branch, we can delete it through the commandgit branch -d 5.1.

How to delete a Git branch

As shown above, the 5.1 branch was successfully deleted, and there is only the tp5 branch at this time.

This article is aboutDeleting Git branchesThe method is also very simple. I hope it will be helpful to friends in need!

The above is the detailed content of How to delete a Git branch. For more information, please follow other related articles on the PHP Chinese website!

git
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more