LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

git-delete-branch

Delete both local and remote branches

TLDR

Delete local and remote branch
$ git delete-branch [branch]
copy

SYNOPSIS

git delete-branch branch

DESCRIPTION

git delete-branch deletes a branch both locally and on the remote in a single command. Part of the git-extras collection, it simplifies branch cleanup by combining what would normally require separate git branch -D and git push origin --delete operations.The command is particularly useful in pull request workflows where feature branches become obsolete after merging. Multiple branches can be passed and will each be deleted in turn.

PARAMETERS

branch

Name of the branch to delete locally and remotely.

CAVEATS

Requires git-extras to be installed. Remote deletion requires push access to the remote. Local deletion uses -D (force), so unmerged work can be lost.

SEE ALSO

Copied to clipboard
Kai