2

So right now these are the branches I have:

WalnutiQ> git branch -a
* develop
  feature-model_in_javascript
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/develop
  remotes/origin/feature-model_in_javascript
  remotes/origin/master

My goal is to delete the branch feature-model_in_javascript so I tried:

WalnutiQ> git branch -d feature-model_in_javascript
Deleted branch feature-model_in_javascript (was 4604f04).

So now when I check my branchs I get:

WalnutiQ> git branch -a 
* develop
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/develop
  remotes/origin/feature-model_in_javascript # <== HOW DO I DELETE THIS????
  remotes/origin/master

How do I delete that remote branch? I manually deleted it by clicking the delete button on https://github.com/WalnutiQ/WalnutiQ/branches

3 Answers 3

6

If you have already manually deleted the branch on the upstream server, then use

git fetch -p

to "prune" your remote tracking branches. Any branches under remotes/origin that no longer exist on the server will be deleted from your local repository.

Sign up to request clarification or add additional context in comments.

1 Comment

@GregHewgill I think git branch -p is used for remove any remote-tracking branches which no longer exist on the remote. I'm not familiar with remote-tracking branch, but it seems remote-tracking is local branch that tracked with remote branch.
1

Just use below to delete the remote branch:

git push origin :<branch>

remove remote tags is the same.

You can find details here: http://git-scm.com/book/en/Git-Branching-Remote-Branches

2 Comments

WalnutiQ> git push origin :feature-model_in_javascript error: unable to delete 'feature-model_in_javascript': remote ref does not exist
@QuinnLiu Try git branch -r to list the remote branches. Check the link you provided, seems no branch named feature-model_in_javascript
1

A slightly more modern syntax for deleting remote branches (perhaps easier to remember) is:

git push origin --delete <branchName>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.