git merge upstream/master "already up
Just a disclaimer: After a few months of working with git, I still have literally no idea what I'm doing when I use it. The only time things work is when I exactly follow the instructions I find on the web on various pages.
What I'm trying to do is update my repository, which is forked from another project. I found that these instructions work and I have been following them every time I want to update
However, this time when I try to merge I get this:
warning: refname 'upstream/master' is ambiguous.
Already up-to-date
And nothing happens, even though the project from which I forked has made recent commits. I don't really know what went wrong, and I'm really frustrated. Sorry if this question is incredibly noobish and/or stupid.
EDIT 1: Also, I have searched for numerous solutions with no success.
EDIT 2: output of git branch -a
* master
upstream/master
remotes/origin/HEAD -> origin/master
remotes/origin/log-upgrade
remotes/origin/master
remotes/origin/past-gens
remotes/origin/prototype-party
remotes/upstream/log-upgrade
remotes/upstream/master
remotes/upstream/past-gens
remotes/upstream/prototype-party
EDIT 3: Similar questions
git refname 'origin/master' is ambiguous
Git: refname 'master' is ambiguous
warning: refname 'HEAD' is ambiguous
Git warning: refname 'xxx' is ambiguous
You've got two branches called upstream/master
. One is a local branch, and one is the branch on the remote. When you try to do a git merge
, git
doesn't know which of these two branches you wish to merge from, hence the ambiguity.
This can be seen from the git branch -a
(show all git
branches, including remotes):
upstream/master
<SNIP>
remotes/upstream/master
To fix this, you could either rename (or delete) the local branch:
git branch -m <old name> <new name>
In your case, you'd rename something like this (change name to newname
):
git branch -m upstream/master newname
This should allow you to do a git fetch
/ git merge
properly.
Either just run:
git merge remotes/upstream/master
instead of
git merge upstream/master
or delete your local upstream/master
branch, by running:
git branch -d upstream/master
And learn how git works ;). It's not that complicated and once you understood the core principles everything is quite easy.
链接地址: http://www.djcxy.com/p/16018.html上一篇: 使用git pull从远程获取所有标签