本番環境でgit pullした時に起こったエラー【error: Your local changes to the following files would be overwritten by merge: composer.lock Please, commit your changes or stash them before you can merge. 】
タイトル通り、本番環境でgit pullを行った時に発生したエラー。解決策は幾つかあるみたいですが、自分が行った方法を書いておこうと思います。
状況
Laravelのwebアプリをgit pulした際に
error: Your local changes to the following files would be overwritten by merge:
composer.lock
Please, commit your changes or stash them before you can merge.
というエラーが出てきました。
要は「対象のファイルでコンフリクトが起きてるから、マージする前にコミットするかスタッシュしてね」ということ。
今回stashでいきました。
"stashを使用すると、コミットしていない変更を退避することができます。
stashで変更を退避させて、今すぐやりたい作業をして、退避させていた変更を戻して作業を再開することができます。"
https://qiita.com/chihiro/items/f373873d5c2dfbd03250
git stash save
その後にちゃんとstashできているかの確認のために
git stash list
でちゃんとリストにあれば、
最初の通りにgit pullをしてくる。無事にpullできたら
git stash pop
これで何も起きなければ無事にマージ完了👍
もっと詳しく知りたければこの方々のがすごく参考になると思います。
https://qiita.com/konweb/items/061475d6376db957b3c4
https://qiita.com/15grmr/items/433ee3b47828aaad32a8
この記事が気に入ったらサポートをしてみませんか?