git pull で composer.lock がロックされる

git pull で composer.lock がロックされる。現在のファイルが最新ではないということだ

  1. git fetch origin
  2. git reset --hard origin/master
  3. git pull

Your local changes to the following files would be overwritten by merge

error: Your local changes to the following files would be overwritten by merge:
protected/config/main.php
Please, commit your changes or stash them before you can merge.
  • 解決方法:

    • 本番サーバーの変更を残し、新しい設定項目だけをマージしたい場合は、次のようにする:
    • git stash
    • git pull
    • git stash pop
  • その後、git diff -w にファイル名を続けて、自動マージの結果を確認できる。

  • 同じように、上の方法でリモートのリポジトリを最新コードとして使うこともできる。

最新情報を受け取る

Telegram や X で毎週のリサーチ、市場シグナル、上場情報をチェック。