Skip to content

Instantly share code, notes, and snippets.

@joshuaaguilar20
Last active July 15, 2020 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuaaguilar20/cd62f7b1ca742aaca8f6edfd15d385ca to your computer and use it in GitHub Desktop.
Save joshuaaguilar20/cd62f7b1ca742aaca8f6edfd15d385ca to your computer and use it in GitHub Desktop.
Deleting Git Repos

Delete a remote branch

$ git push origin --delete <branch> # Git version 1.7.0 or newer 
$ git push origin :<branch> # Git versions older than 1.7.0

Delete a local branch

$ git branch --delete <branch>
$ git branch -d <branch> # Shorter version
$ git branch -D <branch> # Force delete un-merged branches

Delete a local remote-tracking branch

$ git branch --delete --remotes <remote>/<branch>
$ git branch -dr <remote>/<branch> # Shorter
$ git fetch <remote> --prune # Delete multiple obsolete tracking branches
$ git fetch <remote> -p # Shorter'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment