Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hjortur17's avatar

Failed to deploy because of the composer.lock file

Hi, I recently updated to Laravel 5.6 and when I push to GitHub the change go thru but Forge always come's up with an error

From github.com:Hjortur17/nfs

  • branch master -> FETCH_HEAD 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. Aborting Updating 3376a21..ceece9e
0 likes
6 replies
rin4ik's avatar
rin4ik
Best Answer
Level 50

Hi.

git commit -m 'message'

or

git stash

and retry

hjortur17's avatar

How does git stash works? Should I do git add . git commit git stash or?

Nash's avatar

@hjortur17 The error indicates that changes have been made to composer.lock on your server and that they would be overwritten by git pull. It's up to you to decide what should happen with those changes. You can commit or stash the file like @rin4ik suggested, but you can also reset the file to its original state in the repo by doing git checkout <filename-here> (basically undo the changes that were made to it). There's no use in commiting the changes if you don't intend to use them?

I really recommend you watch the Laracasts series on Git to learn the basics. It's not a good idea to just run git commands without understanding what they actually do. https://laracasts.com/series/git-me-some-version-control/episodes/8

2 likes
hjortur17's avatar

No local changes to save - why? I was make-ing changes to my controller

git add . git commit -m "More readable controller" git stash push

No local changes to save

Please or to participate in this conversation.