It is very common issue you might get while using Github and issue is listed below:
Pull is not possible because you have unmerged files. Please, fix them up in the working tree, and then use 'git add/rm
' as appropriate to mark resolution or use 'git commit -a'.
This issue might occur if you have changes in same files or same line of the file.So GitHub is not allowing to pull changed before you merge its index.
Firstly, I don’t understand what is this issue so I searched this issue in google and every site where I get solution and everyone is saying to commit files or remove uncommitted files to pull files from server.
But it is not possible because I want to keep changes and also want to get changes from the server.
Git has three working areas, namely: the working directory (Working Directory), the staging area (Stage or Index) and repository (Repository or Git Directory).
So as the solution of the above issue what I did is, Add the file to Github using git add command because I don’t want to commit local changes to pull changes from server and technically it is not necessary too.
Let’s check the command:
git add filename git stash git pull git stash pop
The git adds command adds a change in the working directory to the staging area, then, change the status Staged state.it was placed Git staging area.Git adds command will inform Git that you have changes in the same file and will include updates to a particular file in the next commit.
Git add command not affect the repository in any way,It just add file contents to the index so changes in the files are not recorded until you run git commit command so it is the safest way or solution you can do when you get above error.
Here, I am done with my article and hope this solution is useful to you and clear your mind, let me know if you have any suggestion/comments/questions on this trick/article.