如何将冲突的文件合并到我的存储库

时间:2016-11-25 08:08:00

标签: git github

我有一个由两个用户使用的主存储库,现在当我推送我的代码时,它会警告我解决冲突。

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

1 个答案:

答案 0 :(得分:1)

$ 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  
相关问题