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

boldstar's avatar

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

I am a little confused on how I should manage this alarm. I a made some changes that i then pushed to my git directory. But when I attempt to deploy my site I get the following alarm

Fri Dec 21 04:22:08 UTC 2018
From github.com:my working directory
 * branch            master     -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
    public/css/app.css
    public/js/main.js
Please commit your changes or stash them before you merge.
Aborting
Updating c2c9380..96ccc95

this is the deploy script

git pull origin master
npm install
npm run production
composer install --no-interaction --prefer-dist --optimize-autoloader
echo "" | sudo -S service php7.3-fpm reload

if [ -f artisan ]
then
    php artisan migrate --force
fi

What do I need to do so it forces the merge? Why does it throw this alarm?

0 likes
2 replies
Nakov's avatar
Nakov
Best Answer
Level 73

The problem is because you are compiling the assets on production server as well as on your local machine.

So when you develop you probably use npm run dev it creates both of those files on your local machine, so before pushing to production you should run npm run production locally and remove the npm run production from the deploy script so it won't do that twice hence no merge conflicts.

At the moment what you can do is git checkout public/css/app.css public/js/main.js on your server, compile the assets locally and deploy to production again, just before remove the npm run production from the deploy script so you don't experience the same conflict again.

boldstar's avatar

@NAKOV - thank you for the help! moving npm run production to my local enviroment did solve my issue.

Please or to participate in this conversation.