0

I read topic How to resolve merge conflicts in Git? but I don't know exactly how i can rolve my problem.

$ git fetch master 
$ git pull origin master 
From https://github.com/BruceleeThanh/StudentManager 
* branch                       master        ->      FETCH_HEAD 
Updating : 43726eb......7c5fe6a 
error: Your local changes to the following files would be overwritten by merge :

BusinessLogic/UserBO.cs 
SchoolManager/Entity/UserEN.cs 

Please, commit your changes or stash them before you can merge .
Aborting

Help me. Please !

Community
  • 1
  • 1
Loint
  • 3,560
  • 7
  • 26
  • 46

4 Answers4

1
git stash
git pull origin master
git stash apply

still if you get conflicts then find them using

git diff

and fix them manually.

NIlesh Sharma
  • 5,445
  • 6
  • 36
  • 53
1

If you any local changes those were not committed then you have to commit them first or stash them.

git stash clear // clear previous stashes
git stash // save the local changes
git pull origin master // pull the branch
git stash apply // apply the local changes

After that if you have any conflicts then resolve them and the commit again.

Sougata Bose
  • 31,517
  • 8
  • 49
  • 87
1

If you want the files to be saved in your origin then,

git add filename
git commit -m "file commit"
git push origin 

OR If you dont want the files on your branch then,

git checkout filename
Developer
  • 1,409
  • 2
  • 23
  • 46
1

There are several ways to act.

The other solutions are right.

Other way is to create a branch where to save your local changes. Then, you will decide what to do with them.

First create the branch and checkout to it:

git checkout -b myTempBranch

Second you add and commit the changes (In your case 2 files):

git add BusinessLogic/UserBO.cs SchoolManager/Entity/UserEN.cs
git commit -m "Changes to review after pulling"

Finally, you checkout master and pull

git checkout master
git pull origin master
blashser
  • 921
  • 6
  • 13