Home git Error “Your local changes to the following files would be overwritten by...

Error “Your local changes to the following files would be overwritten by merge” on update

Author

Date

Category

Learning Laravel . Out of inexperience, I climbed into the public directory, in which I corrected the files. Then I push to push my changes to master branch to bitbucket .

After that, I decided to update the server so that the changes appeared on the site, but when update , an error appeared:

error: Your local changes to the following files would be overwritten by merge: public / js / all.js
Please, commit your changes or stash them before you can merge.

I cannot fix the error and upload updates to the server.

I tried using the git rm --cached public / js / all.js command to remove my edits from the index to push again, and then update the server from the repository , but a new error appeared:

Commit failed with error:
On branch master
Your branch is up-to-date with ‘origin / master’.

Untracked files:
public / fonts /
public / i /
public / uploads /
public / vendor /
resources / lang / tg / welcome.php
storage / locations.php
storage / profs.php

nothing added to commit but untracked files present


Answer 1, authority 100%

on your server the file has been changed public / js / all.js

You can update the server by commit , rolling back checkout , or hiding stash
after which the server will be updated

and similar needs to be added to the .gitignore

exceptions

public / uploads /
public / vendor /

Answer 2, authority 93%

You can save changes in the working directory before merging:

  1. git stash save
  2. git merge origin / master
  3. git stash pop

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions