2015-07-21 90 views
0

我已阅读主题How to resolve merge conflicts in Git? 但我不知道具体如何解决我的问题。我该如何解决合并冲突git

$ 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 

帮帮我。请 !

+0

您应该'git-commit'您的更改或['git-stash'](http://git-scm.com/docs/git-stash)它们。 – NightShadeQueen

回答

1

如果您有任何local更改那些不是committed那么你必须commit他们第一个或stash他们。

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 

之后,如果您有任何当时的解决这些问题,并再次commit

1
git stash 
git pull origin master 
git stash apply 

仍然如果你再使用冲突

git diff 

找到他们,手动修复它们。

1

如果你想将文件保存在您的起源那么,

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

OR 如果你不想在你的分支的文件,然后,

git checkout filename 
1

有几种方式行事。

其他解决方案是正确的。

其他方法是创建一个分支以保存您的本地更改。然后,你会决定如何处理他们。

首先创建分支和检验它:您添加

git checkout -b myTempBranch 

二并提交更改(在你的情况下2个文件):

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

最后,您签主人和拉

git checkout master 
git pull origin master