Git tracking and deleting remote branches

List the remote branches that exist for a repository you have cloned:

git remote show origin

Create a local branch that tracks one of the remote branches and then use that local branch:

git checkout --track -b name_of_local_branch origin/name_of_remote_branch

If you have not done a pull since someone else created the remote branch, you may first need to do:

git fetch

Remove branch from repo.

git push {repo} :heads/{branch}

Ex: git push origin :somebranch removes somebranch

comments powered by Disqus