Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Deleting local branches

You can delete a local branch by

Code Block
git branch -d <localBranchName>

This one has come in handy a few times: if you want to delete all local branches (maybe to clean up) except master, you can do

Code Block
git branch | grep -v "master" | xargs git branch -D 

Note: assumes master branch is called "master".

Deleting remote branches

Deleting a local branch is pretty straight forward - but what about deleting its remote branch?

To do this simply execute the following from git bash:

bash
Code Block
language
git push <remote> --delete <branch>

Where <remote> is the remote repo (e.g. origin etc.) and <branch> is the name of the remote branch to delete.

Content by Label
showLabelsfalse
max5
spacesTKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "git" and type = "page" and space = "TKB"
labelsgit

...