17

デフォルト以外のブランチを追跡するリポジトリがあります。したがって、「origin/master-13.07」を追跡する必要がある「master」という名前のローカル ブランチがあります。「push -u」を実行しましたが、これで十分だと思います。ブランチは追跡されます。の出力git branch -vv:

C:\work\repo>git branch -vv
  stuff     68792df [origin/stuff-13.07] Small bugfix
* master 68792df [origin/master-13.07: ahead 1] Small bugfix

の出力git status

C:\work\repo>git status
# On branch master
# Your branch is ahead of 'origin/master-13.07' by 1 commit.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean

すべて問題ないように見えますが、「git push」を使用すると (上記で git が推奨しているように)、失敗します。

C:\work\repo>git push
fatal: The upstream branch of your current branch does not match
the name of your current branch.  To push to the upstream branch
on the remote, use

    git push origin HEAD:master-13.07

To push to the branch of the same name on the remote, use

    git push origin master

はい、名前が一致しないことはわかっています。これはまさに私が望んでいるものであり、「push -u」で git するように指示しました。「プッシュ」だけを使用できないのはなぜですか?

C:\work\repo>git --version
git version 1.8.3.msysgit.0

C:\work\repo>git config push.default
simple
4

2 に答える 2

21
于 2013-06-11T13:54:21.270 に答える
0

Git 2.20 (2018 年第 4 四半期) では、アドバイスが若干変更されます。

Ævar Arnfjörð Bjarmason ( )によるコミット 8247166 (2018 年 11 月 13 日)を参照してください。( 2018 年 12 月 1 日コミット 2c23f0bJunio C Hamanoによってマージされました)avar
gitster

push: 不必要にあいまいな例を誤って変更してください

現在の設定がたまたま「push.defaultsimplesimple

このエラーは " simple" でのみ発生しますが、メッセージは、これら 2 つの呼び出しによって 2 種類の異なる動作が得られることをユーザーに説明しています。

使用しましょう:

  • " git push <remote> HEAD" は常に現在のブランチ名をそのリモートにプッシュすることを意味します。
  • " "の代わりに " git push <remote> <current-branch-name>" の下でそれを行いますが、" simple" の下で行うことは保証されていませんupstream
于 2018-12-02T02:14:23.103 に答える