Git 拉到非远程分支

Git pull to a non remote branch

我有一个分支,但我不想将其作为远程分支,因为我只是将它用于测试目的。现在,当我尝试从我的远程主分支拉取(获取并合并)到我的分支时,出现错误:

fatal: No remote for the current branch.

如何将我的远程主分支与我的非远程分支合并

编辑:我不想合并和更改本地主分支。我想直接将远程master合并到本地测试分支

我希望您目前在您不想提交的本地分支中。

 $ git commit -am "Commit message"
 $ git checkout master
 $ git pull origin master
 $ git checkout branch_name
 $ git merge master

如果我没理解错的话

你必须 git 拉到你的 master 分支,然后在你的 non-master 分支,"git rebase master"

您需要从您的 master 分支拉取到您的其他分支。

您可以像这样指定合并分支的位置:

git merge origin/master

这会将 origin 的 master 分支合并到您的本地分支。