Patricio Treviño · 21 June, 2018 · 1 min read
Delete a local and remote git branch using the terminal
Syntax
|
git branch <[-dr | --delete --remotes]> <remote>/<branch> |
Option |
Description |
remote |
The remote to be used. |
branch |
The remote branch to be deleted. |
Note: valid options are:
-dr, is a synonym of --delete --remotes
--delete, deletes the local branch with no pending merges.
--remotes, tells git to delete the remote tracking branch too.
Example
|
# deletes remote and local branch "my-branch" |
|
git branch --delete --remotes origin/my-branch |
|
|
|
# same as above |
|
git branch -dr origin/my-branch |
References
git-branch