根本的な原因:説明を短くするために、あなたlocal/productionが追跡していないように見えますorigin/production。で確認できますgit branch -avv。
Aboutgit pushgit 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/productionproductionproductionlocal/production
- 変更をプッシュしたい瞬間、
mergeまたはcherry-pickコミットして変更productionをプッシュしたい瞬間git push origin production:production。