I have a problem with the command "git pull". i have two stash users and in one user it works fine and in the other it gives an error message saying: You asked me to pull without telling me which branch you want to merge with. Please specify which branch you want to use on the command line and try again (e.g. 'git pull '). See git-pull(1) for details.
我的命令“git pull”有问题。我有两个藏匿用户,在一个用户中它工作正常,在另一个用户中它给出了一条错误消息:你让我拉而不告诉我你要合并哪个分支。请在命令行中指定要使用的分支,然后重试(例如'git pull')。有关详细信息,请参阅git-pull(1)。
i spotted the problem but dont know how to fix it. When i checkout to my branch it is not writing it into the .git/config file. however, this is happening only when I create the branch, when others create the branches i can access them and it is written in the .git/config file.
我发现了问题,但不知道如何解决它。当我结账到我的分支机构时,它没有将它写入.git / config文件。然而,只有当我创建分支时才会发生这种情况,当其他人创建分支时我可以访问它们并且它被写在.git / config文件中。
why is this happening? Thanks,
为什么会这样?谢谢,
1 个解决方案
#1
It's likely that the user with a problem has the branch checked out locally, but it is not tracking the remote branch. You can fix this with the following:
有问题的用户可能在本地签出了分支,但它没有跟踪远程分支。您可以使用以下方法解决此问题:
git branch --set-upstream branchname origin/branchname
It is possible that the local branch was created for this user before the remote branch existed — or before a git fetch
found it. (This is because git checkout branchname
has different behaviour depending on whether a remote branch with the same name is found.)
在远程分支存在之前 - 或者在git fetch找到它之前,可能是为该用户创建了本地分支。 (这是因为git checkout branchname具有不同的行为,具体取决于是否找到了具有相同名称的远程分支。)
An alternative approach is to delete the local branch and re-checkout from the remote:
另一种方法是从远程删除本地分支并重新签出:
git branch -d branchname
git checkout branchname
The newly checked-out branch will now be tracking the remote branch origin/branchname
.
新签出的分支现在将跟踪远程分支origin / branchname。
If you're paranoid about losing any local changes, you can make sure you don't lose them by creating a new branch before you delete the old one:
如果您对丢失任何本地更改感到妄想,可以通过在删除旧分支之前创建新分支来确保不会丢失它们:
git branch branchname_backup branchname
As always, I highly recommend tig to get a better understanding of what your branches are doing.
与往常一样,我强烈建议您更好地了解您的分支机构正在做什么。
#1
It's likely that the user with a problem has the branch checked out locally, but it is not tracking the remote branch. You can fix this with the following:
有问题的用户可能在本地签出了分支,但它没有跟踪远程分支。您可以使用以下方法解决此问题:
git branch --set-upstream branchname origin/branchname
It is possible that the local branch was created for this user before the remote branch existed — or before a git fetch
found it. (This is because git checkout branchname
has different behaviour depending on whether a remote branch with the same name is found.)
在远程分支存在之前 - 或者在git fetch找到它之前,可能是为该用户创建了本地分支。 (这是因为git checkout branchname具有不同的行为,具体取决于是否找到了具有相同名称的远程分支。)
An alternative approach is to delete the local branch and re-checkout from the remote:
另一种方法是从远程删除本地分支并重新签出:
git branch -d branchname
git checkout branchname
The newly checked-out branch will now be tracking the remote branch origin/branchname
.
新签出的分支现在将跟踪远程分支origin / branchname。
If you're paranoid about losing any local changes, you can make sure you don't lose them by creating a new branch before you delete the old one:
如果您对丢失任何本地更改感到妄想,可以通过在删除旧分支之前创建新分支来确保不会丢失它们:
git branch branchname_backup branchname
As always, I highly recommend tig to get a better understanding of what your branches are doing.
与往常一样,我强烈建议您更好地了解您的分支机构正在做什么。