I have just begun to work on a new branch that someone has cleverly called tag
. Now when I try to pull the changes, using:
git pull origin tag
I get the error:
fatal: You need to specify a tag name.
Which I can only assume is because tag
is a keyword... I have tried to use single/double quotes:
git pull origin 'tag' then I tried...
git pull origin "tag" then...
git pull origin `tag` ...you get the gist...
git pull origin <tag>
git pull origin \tag
to pull but I get the same result.
Is there a method to use that allows you to pull changes from a keyword-named branch?
git pull <remote> <refspec>
Since that second parameter is a refspec, you can use the extended syntax to make sure that Git doesn’t try to do something with tags there. The extended syntax is localbranch:remotebranch
. So if you just want to pull the tag
branch, you can do this:
git pull origin tag:tag
The same problem appears with git push
btw. and can be worked around in the same way:
git push origin tag:tag