The problem
Today, I was updating an old git repository but when I tried to delete some branches in my local environment and in the remote, I received this kind
“remote ref does not exist”
And that is because some remote branches didn’t exist anymore.
Solution
In order to update the references in our local machine we can use the git fetch command in this format:
git fetch -p MY_REMOTE // Example git fetch -p origin
From Stack Overflow:
“The -p
option tells fetch to delete any tracking branches that no longer exist in the corresponding remotes; by default they are kept around”.
That’s it for today enjoy your work!
Thanks Alex – great tip ! Exactly what I was looking for.