根本的な原因:説明を短くするために、あなたlocal/production
が追跡していないように見えますorigin/production
。で確認できますgit branch -avv
。
Aboutgit push
git push
:引数を指定しないと、ローカルの追跡ブランチで更新されたすべてのリモート ブランチが更新されることに注意してください (git-push(1)
マニュアル ページから):
git push ... [<repository> [<refspec>...]]
The special refspec : (or +: to allow non-fast-forward updates) directs git to
push "matching" branches: for every branch that exists on the local side, the
remote side is updated if a branch of the same name already exists on the remote
side. This is the default operation mode if no explicit refspec is found (that is
neither on the command line nor in any Push line of the corresponding remotes
file---see below).
ローカル ブランチでどのような変更が行われたかを忘れると、simple の結果がgit push
予期しないものになることがあるため、個人的にはプッシュするブランチを明示的に指定するのが好きです。あなたの場合、これがあなたがやりたいことのようです:
git push origin local/production:production
local/production
を追跡したい場合は、オプションを使用しorigin/production
てlocal/production
追跡ブランチを作成できます。origin/production
-u
git push -u origin local/production:production
(一度だけ必要です)。次に、原点から にプルできますlocal/production
。
エグゼクティブ サマリー:ブランチの追跡の概念と の固有のセマンティクスを理解する必要がありますgit push
。
PSここでのブランチ名の選択について疑問に思っていますlocal/production
。だけではないのはなぜproduction
ですか?あなたはすでにproduction
追跡origin/production
を行っており、おそらくlocal/production
ローカル開発に使用していると思われます。この場合、合理的なワークフローは次のようになります。
git pull origin production:production
変更をあなたに引っ張るproduction
- に新しいコミットがある場合
production
、つまり遅れている場合は、 on をlocal/production
リベースする(または on をマージする)local/production
production
production
local/production
- 変更をプッシュしたい瞬間、
merge
またはcherry-pick
コミットして変更production
をプッシュしたい瞬間git push origin production:production
。