2016-11-25 92 views
0

我有一个由两个用户使用的主存储库,现在当我推送我的代码时,它警告我解决冲突。如何将冲突的文件合并到我的存储库

我想合并我的代码到现有的代码与git命令,但我不知道如何解决这个问题。

+3

的可能的复制[如何解决在Git中合并冲突?(http://stackoverflow.com/questions/161813/how-to-resolve-merge-conflicts-in-git) – jonrsharpe

回答

0
$ git commit -am <message>  # add & commit your local changes 
$ git pull origin master   # pull the latest codes 
$ git status      # see the files that have conflicted (untracked files) 

# If you want to keep your changes then 
$ git checkout . --ours 

# Or, if you want to keep remote changes 
$ git checkout . --theirs 

$ git commit -am <message>   # add & commit with a new message 
$ git push origin master    # push to remote 
+0

当我命令git pull origin master它返回错误:因为您有未合并的文件,所以不可能拉动 –

+1

您应该首先添加并提交您的更改。 'git commit -am ' –