Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'git branch -a' still showing deleted remote branch in the remote repo?

Tags:

git

I have uploaded (pushed the entire local branch) to the remote repo. I have merged it with master and deleted it in the remote repo (on github.com)

Running git branch -a still shows it in the console:

$ git branch -a
* master
  remotes/hivauz/master
  remotes/hivauz/new_local_branch

What's the reason, does github need time to update it?

like image 509
ERJAN Avatar asked Dec 17 '18 19:12

ERJAN


People also ask

How remove deleted branch from remote?

Steps to delete remote Git branchesIssue the git push origin –delete branch-name command, or use the vendor's online UI to perform a branch deletion. After the remote branch is deleted, then delete the remote tracking branch with the git fetch origin –prune command.

What happens when you delete a remote branch?

Deleting both a local and a remote branchThey are completely separate objects in Git. Even if you've established a tracking connection (which you should for most scenarios), this still does not mean that deleting one would delete the other, too!

Does git prune delete remote branches?

git fetch --prune is the best utility for cleaning outdated branches. It will connect to a shared remote repository remote and fetch all remote branch refs. It will then delete remote refs that are no longer in use on the remote repository.

How do I clean up remote branches?

In order to clean up remote-tracking branches while fetching, use the “git fetch” command with the “–prune” option. Alternatively, you can simply use the “-p” shortcut instead of typing “prune” every time.


1 Answers

You have to run git fetch --all --prune in order to remove the remote branch reference in your local environment.

like image 59
eftshift0 Avatar answered Nov 14 '22 23:11

eftshift0