Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pathspec upstream/master is ambiguous

Tags:

git

github

I can push, pull and checkout upstream/master no problem at all but I do get a warning. Upstream/master is for tracking the changes made to the original source code from which I forked (having followed github instructions).

E.g.

$ git checkout upstream/master
warning: refname upstream/master is ambiguous

$ git branch -a
* master
  upstream/master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/upstream/master

This command also has the ambiguous error:

$ git branch
* master
  upstream/master

$ git checkout upstream/master filename.bar
like image 544
Gabe Avatar asked Jun 27 '26 13:06

Gabe


1 Answers

This page mentions the usual cause for this kind of message:

When you try to checkout a local branch, you get a

warning: refname 'branch-name' is ambiguous

This can happen if you've created a local branch with the same name as a remote tag.
Git should be checking out your local branch, but instead it's trying to checkout the tag, and it gets confused.

In general, when creating tags, be careful not to have names that conflict with existing (local or remote) branches.

like image 164
VonC Avatar answered Jun 30 '26 02:06

VonC