5

私のレポには、masterブランチとnewブランチがあります。

私はnewしばらくの間、コミットとプッシュを行いながら作業を続けてきました。私は今、分岐しnewてそれを と呼ぶことにしましたnewest。だから私はやった

git checkout -b "newest"

ブランチが正常に作成されました。ファイルを追加して、作業を開始しました。変更を数回コミットしました。

しかし、この新しいブランチとそれに加えた変更を にプッシュしようとするとorigin、次のエラーが発生します。

C:\wamp\www\myproj>git push origin
To https://github.com/Imray/Proj.git
 ! [rejected]        master -> master (non-fast-forward)
 ! [rejected]        new -> new (non-fast-forward)
error: failed to push some refs to 'https://github.com/Imray/Proj.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details. 

そのため、指示で指定されているように、試してみまし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> newest

私は立ち往生しています。

新しいブランチと変更を にプッシュするにはどうすればよいgithubですか?

4

2 に答える 2

2

を確認してくださいgit config push.default。" " にある可能性があります。これmatchingは、既存のすべてのブランチをプッシュしようとするためです。
これはGit 2.0+ より前のデフォルトでした。

simple現在のブランチのみをプッシュするには、" " に設定することをお勧めします。

そうは言っても、ブランチをプッシュするには、(最初のプッシュで)アップストリーム ブランチをセットアップする必要があります。

以前にプッシュしたことがないブランチの場合:

git push -u origin newest

アップストリーム repoに存在するブランチの場合:

git branch --set-upstream-to=origin/master master
git branch --set-upstream-to=origin/new new

それからgit checkout master ; git pull would作品。

于 2015-01-01T13:48:35.447 に答える
0

これを試して :

それが役に立てば幸い

于 2015-04-16T15:33:48.650 に答える