Home>Article>Development Tools> How to delete a Git branch
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.
There 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.
If we want to delete the 5.1 branch, we can delete it through the commandgit branch -d 5.1.
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!