Git跟踪远程分支无法使用git push?

时间:2015-03-19 21:02:33

标签: git github version-control

我正在使用Git版本1.9.5

我想了解远程分支跟踪是如何工作的。

我创建了一个本地分支来跟踪我的远程主分支:

git checkout -b feature-a origin/master

一旦我运行上面的命令,Git就会向我显示以下消息 “分支功能 - 用于从原点跟踪远程分支主控的设置。 切换到新分支'feature-a'“

现在我运行以下命令:

git pull

似乎跟踪工作正常,Git知道要从哪个远程分支中获取。

现在我创建一个新文件test.txt并提交并推送。

git push 

它向我显示以下消息:

warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Everything up-to-date

我的问题:“git push”是否也适用于远程分支跟踪或只能使用“git pull”?

网上有很多文章说他们可以通过远程分支跟踪进行“git push”。

1 个答案:

答案 0 :(得分:1)

这是一个警告。你的推动发生了。

相关问题