Patricio Treviño

Patricio Treviño

Husband . Father . Developer
4total entries in repository

Delete a local and remote git branch using the terminal

Syntax

git branch <[-dr | --delete --remotes]> <remote>/<branch>
view raw syntax.text hosted with ❤ by GitHub

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.

Delete a local git branch using the terminal

Syntax

git branch <[-D | -d | --delete]> <branch>
view raw syntax.text hosted with ❤ by GitHub

Option Description
option The delete option to be used.
branch The local branch to be deleted.

Note: valid options are:
-D, forces the deletion of the local branch even if there are pending merges.
-d, is a synonym of --delete.
--delete, deletes the local branch with no pending merges.

Delete a remote git branch using the terminal

Syntax

git push <remote> --delete <branch>
view raw syntax.text hosted with ❤ by GitHub

Option Description
remote The remote to be used.
branch The remote branch to be deleted.

Prunes the repository from deleted remote branches using the terminal

Syntax

git fetch [remote] [-p | --prune]
view raw syntax.text hosted with ❤ by GitHub

Option Description
remote The remote to be used (defaults to origin).