hi
Scenario--
I am having multiple remote personal branch which we use for personal backup but post our task finished we need to delete those personal branch but I am not able to delete those.
What I am doing?
I am using some commands to delete those branch
git push origin :refs/origin/personal/SSOID/branch_Name
git push --force origin :refs/origin/personal/SSOID/branch_Name1
What is happening?
The above command are showing success but when I check from another git instance those command are present means not deleted from remote.
Each repo has it's own remote tracking branches. If you delete the branch on the server copy, the one on your computer will still be there. You have to also delete your local branch. So you have two branches to delete. The tracking branch origin/personal/SSOID/.,.. and you have your local branch in your local repo that matches with that branch.
In the one you are checking, you are seeing the existing tracking branch. The remote branch has already been deleted. Git is distributed but it is more like silos with wires. I put something in silo1 and push it to silo 2. Silo2 now has what I did in silo1. If I delete the branch in silo1, silo2 will still have a tracking branch to that branch.
You can remove the stale tracking branches that vbjay described from any "other git instance" for a remote named "origin" by using the following command on each other git instance:
git remote prune origin
Or, in GitExtensions:
Related to #1583
Related to this would be an easy means to set --prune
during git fetch
, e.g. for comparison, SourceTree's fetch dialog has a checkbox for it. I find GitExtensions more efficient to use for almost everything, but git fetch --prune
is one notable exception to that.
Most helpful comment
You can remove the stale tracking branches that vbjay described from any "other git instance" for a remote named "origin" by using the following command on each other git instance:
Or, in GitExtensions: