Thursday 14 May 2020

Git: How to fix Error Pulling is not possible because you have unmerged files



If you try to pull new code while some local files have been changed without commit, you will get this error.

Error Pulling is not possible because you have unmerged files.
or
Error: Your local changes to the following files would be overwritten by merge
To fix it you have 2 options:

* Method 1: Commit the changes, then pull the new code
- Add new files if available
git add filename1.xyz folder/filename2.xyz  
or (add all new file)
git add -A    
- Commit new changes

git commit -m "Add new file or something need to noted"
* Method 2: Remove all local changes to update new code
(We often encounter this situation on the server)
To do so, run the following command:

git reset --hard origin/master
- note: 'master' is the name of the branch you want to update new code from that.

Done ! Now we can update new code by git pull command.

git pull




0 nhận xét:

Post a Comment