How to delete a branch in git using tortoiseGit
Creating and deleting branches in git repositories are common operations used by developers every day.
We can do this either in the Command line with the git command in the terminal or using the Git client tool.
Git Client tools are useful for developers
How to delete branches locally and remotely in the TorotiseGit tool
Let’s see how to delete a local and remote branch in the github repository.
Following are steps
Local branch is a branch that exists in your machine, removing the local branch does not delete the remote repository
First Checkout to any branch except that branch you want to delete it
For example, You have local branch names - master,mywork
Checkout to master - TorotiseGit -> Switch/Checkout and select master branch
Now you are on the master branch.
In Windows File Explorer, Open a project, position the cursor, and right-click on it.
It shows Context Menu, select TortoiseGit -> Browser References
It Opens a window, select below to remove the local branch
-Select
Head
-> local branch namemywork
, Right click on it- It shows the context menu, select delete branch`, and Click Ok to delete a local branch
Again to remove a remote branch, Click on select
TortoiseGit
->Browser References
It Opens a window, select below to remove the remote branch-Select
remote
-Origin
-> select remote branch namemywork
, Right click on it- It shows the context menu, select
Delete remote branch
, and Click Ok to delete a branch
- It shows the context menu, select
The local branch will not be deleted if the project checkout the same branch name.
If you are not seeing browser References in the torotiseGit context Menu, Please do the following things
- Go to TortoiseGit settings and select Set Extended Menu and deselect Browser References.
Similarly, You can delete a branch using the git log window
- Open the Git log window using right clicking on the project, Select TorotiseGit -> show log
- Select the log message, It shows the message and branch with colored.
- Select the colored branch and right-click, select Delete refs/remote/origin/branch option
- It removes the branch successfully