Linked Questions
15 questions linked to/from Git remote branch deleted, but still it appears in 'branch -a'
17 votes
3 answers
5k views
Remove remote branches in Git [duplicate]
I want to delete some remote branches of my project repository. I've run the next command: git push origin :name_of_branch and when I list the remote branches with git branch -r the branch that I've ...
0 votes
1 answer
101 views
`git-branch` keeps showing remote `upstream/master` after removing it [duplicate]
I decided to remove the upstream remote reference from my local repository, but git-branch keeps showing remotes/upstream/master. I pruned the references, but it keeps showing upstream. How do I clean ...
0 votes
0 answers
51 views
How to remove non-existent Git remote references created in error [duplicate]
I was trying to fetch open PR's by running this command but I've created refs that are completely invalid: git fetch origin '+refs/pull/*/merge:refs/remotes/$rem/open-pr/*' Now I can't delete them. ...
0 votes
0 answers
23 views
git branch -a shows branch that can not be removed locally and is not present in remote [duplicate]
I have a repo hosted in Github. The command git branch -a shows the following: * develop master remotes/origin/HEAD -> origin/master remotes/origin/develop remotes/origin/master remotes/...
20362 votes
41 answers
13.2m views
How do I delete a Git branch locally and remotely?
Failed Attempts to Delete a Remote Branch: $ git branch -d remotes/origin/bugfix error: branch 'remotes/origin/bugfix' not found. $ git branch -d origin/bugfix error: branch 'origin/bugfix' not found....
2767 votes
52 answers
1.1m views
How do I delete all Git branches which have been merged?
How do I delete branches which have already been merged? Can I delete them all at once, instead of deleting each branch one-by-one?
654 votes
8 answers
229k views
Fetch from origin with deleted remote branches
When I do git fetch origin and origin has a deleted branch, it doesn't seem to update it in my repository. When I do git branch -r it still shows origin/DELETED_BRANCH. How can I fix this?
505 votes
4 answers
473k views
What are the differences between git remote prune, git prune, git fetch --prune, etc
My situation is this... someone working on the same repo has deleted a branch from his local & remote repo... Most people who have asked about this kind of problem on Stack Overflow, or other ...
192 votes
12 answers
82k views
Delete local Git branches after deleting them on the remote repo
I want to have my local and remote repositories always in sync in terms of branches. After a Pull Request review on GitHub, I merge and remove my branch there (remote). How could I fetch this ...
7 votes
1 answer
4k views
'git branch -a' still showing deleted remote branch in the remote repo?
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:...
4 votes
1 answer
4k views
How do I list all local tracking branches not pushed in git?
I'm working in a git repository on multiple tracking branches, and by the end of the day I don't know if I pushed all my work in all branches. Is there a git command showing which branches are not ...
4 votes
3 answers
2k views
How to sync up my local git repo and delete branches that are gone in remote repo
I have seen many somewhat similar stackoverflow questions regarding this. I have tried many ways but am still stuck. I have a script like this: git fetch --prune for k in $(git branch --merged| ...
1 vote
1 answer
1k views
git post delete hook?
My home computer is behind a corporate VPN firewall and is not accessible from outside. I am trying to keep my github repo as identical as possible to my desktop's repo. I have the following hooks:...
1 vote
3 answers
516 views
git branch -r shows different remote shared repo in different local working directory
I created a shared repo and then clone it into two folders (A and B). All in the same PC. Now there are two branches, master and v0. Folder A and B are now in branch v0. On A I deleted the v0 branch ...
1 vote
1 answer
126 views
How do we remove branches that no longer exist from the auto complete in Git?
^ For example, you can see that after I run git br (alias for git branch) I no longer have the fix/add-themed-validation branch, I deleted it. However when I try to check out a different branch with ...