2013-08-28 96 views
12

我更改了一个我的朋友正在同时工作的文件。我做了一些改变,现在我想推它,但它说我应该先拉。当我git pull,它说:Git pull自行中止,本地文件更改将被合并覆盖

error: Your local changes to the following files would be overwritten by merge: Please, commit your changes or stash them before you can merge.
Aborting

如何合并文件?如果我这样做,我朋友的文件会完全改变吗?我确信他已经添加了一些东西,并且我添加了我的东西。我们的更改将如何处理?

+0

可能重复http://stackoverflow.com/questions/15745045/how-do-i-resolve -git-说提交 - 您 - 变化 - 或藏匿了他们,才吃到-ME) – stdcall

回答

2

git commit然后git pull。它首先获取您的朋友更改,然后合并您的更改,不会丢失任何内容。

更改之间的冲突将被表示这样的方式:

Here are lines that are either unchanged from the common 
ancestor, or cleanly resolved because only one side changed. 
<<<<<<< yours:sample.txt 
Conflict resolution is hard; 
let's go shopping. 
======= 
Git makes conflict resolution easy. 
>>>>>>> theirs:sample.txt 
And here is another line that is cleanly resolved or unmodified. 

或者你可以使用一些交互合并工具。

20

一种方法是首先提交该文件然后再提取。

git add filename 
git commit 
//enter your commit message and save 
git pull 

另一种方法是隐藏您的更改然后拉动。然后申请藏匿。

git stash 
git pull 
git stash apply [email protected]{0} 
的[我如何解决混帐话“提交更改或藏匿,然后才能合并”?](
相关问题