skip to Main Content

I made some modifications in the myproject_app/vendor/laravel/ui/auth-backend/AuthenticatesUsers.php; then I pushed the modifications with other files. When I tried to make git pull then I got error :

error: Your local changes to the following files would be overwritten by merge:
        myproject_app/vendor/laravel/ui/auth-backend/AuthenticatesUsers.php
Please commit your changes or stash them before you merge.
Aborting

So how to fix it ? I tried to add tokenlite_app/vendor/laravel/ui/auth-backend/AuthenticatesUsers.php in the .gitignore file which I pushed after receiving the error, but got same results

2

Answers


  1. Chosen as BEST ANSWER

    After googling I made a git reset --hard, then I made composer update.


  2. In most cases, the message Git provides is more than enough to solve the issue you are facing in the git.

    "Please commit your changes or stash them before you merge."

    Seeing the error the file vendor/laravel/ui/auth-backend/AuthenticatesUsers.php is still being modified either restore it back using

    git checkout vendor/laravel/ui/auth-backend/AuthenticatesUsers.php
    

    or

    git restore <file>
    

    You can just commit that file if you really need to update it, but vendor files should not be updated directly, it is better to fork if you are really in desperate need to update it. Or check if the package has some publish mechanism.

    Deleting the vendors and such will not work since you have already pushed the vendor to the repo and doing composer install/update will just generate a new one which you need to again commit and push the new vendors and merge that, with the chance of merge conflicts if multiple developers are working on that repo.

    Also, if you have already pushed the files to the repo, ignoring it afterwards is not simple like just adding that file path to .gitignore, you will need to follow a few more steps after adding on the .gitignore.
    Follow this Stackoverflow question for more info https://stackoverflow.com/a/1139797/8630903

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search