2015-07-21 89 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