2016-07-31 8 views
1

2番目のgit pushにエラーがありますが、同じプルリクエストにいくつかの新しい変更を加えたいだけですが、この問題を解決する方法はありますか?ありがとう。strange git pushエラー

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 [email protected]:foo/goo.git 
! [rejected]  newFooBranch -> newFooBranch (non-fast-forward) 

error: failed to push some refs to '[email protected]: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

他の誰もそのブランチにコミットしてプッシュしていない場合、おそらく 'git checkout'コマンドでローカルHEADポインタを移動しました。 githubを見て、あなたのローカルコミットとは異なるコミットを見てください。 –

+0

@AndyRay、ありがとうございました。 「ギブスを見て、あなたのローカルコミットとは異なるコミットを見てください」という意味はどうですか? github.comにセクションがありますか? –

答えて

1

のいずれかの操作を行います。

git pull

かを:

git remote update 
git rebase origin/newFooBranch 

をあなたの変更をプッシュする前に。

+0

「Git pull」を実行したときにNishantに投票してエラーが発生しました。元の投稿の編集1のセクションに投稿してください。もし考えがあれば素晴らしいでしょう。 –

+1

'git pull origin newFooBranch'を試してください。 –

+1

また、 'git branch -set-upstream-to = origin/newFooBranch newFooBranch'を実行するとエラーメッセージが表示されます。本質的にgitはどのブランチを引き出すのかを知らないので(より新しいブランチがアップストリームなしで作成されたので)、より具体的になるように頼みます。 –