奇怪的git推错误

时间:2016-07-31 05:02:19

标签: git github

遇到第二个git push中的错误,我只是想对同一个Pull Request添加一些新的更改,有什么想法如何解决这个问题?感谢。

Git运营

git checkout -b newFooBranch
git add <name of file changed>
git commit -m 'add some initial changes'
git push origin newFooBranch

// make some changes
git add <name of same file changed>
git commit -m 'add some new changes on the same file'
// met with error when executing below command
git push origin newFooBranch

错误消息

To git@github.com:foo/goo.git
 ! [rejected]        newFooBranch -> newFooBranch (non-fast-forward)

error: failed to push some refs to 'git@github.com:foo/goo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

修改1

git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> newFooBranch

的问候, 林

1 个答案:

答案 0 :(得分:1)

要么:

.keys()

或:

git pull
在推动改变之前

相关问题