Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (29.3k points)

Here is my git workflow.

I work from two different computers (A and B) and store a common git remote in the dropbox directory.

Let's say I have two branches master and devel. Both are tracking their remote counterpart's origin/master and origin/devel.

Now while on computer A, I delete branch devel - both local and remote - as follows:

git push origin :heads/devel

git branch -d devel

Now if I do git branch -a on computer A, I get




I now go to computer B. Do git fetch. I can remove the local devel branch by

git branch -d devel

But I can't remove the remote devel branch.

git push origin :heads/devel

error: unable to push to unqualified destination: heads/proxy3d

The destination refspec neither matches an existing ref on the remote nor

begins with refs/, and we are unable to guess a prefix based on the source ref.

fatal: The remote end hung up unexpectedly

Doing git branch -a still lists origin/devel in remote branches.

How can I clean up the remote entry of the devel from machine B?

1 Answer

0 votes
by (50.2k points)

you have already deleted heads/devel on origin, so that's why you can't delete it from machine B. for that you need to use the following commands as the error is not clear from question try these commands: 

git branch -r -d origin/devel


git remote prune origin


git fetch origin --prune

And you can add --dry-run option to see the status of running. The above commands will help you to clean up the old remote git branches.

Browse Categories