v2ex_com
校友
校友
  • UID186
  • 粉丝1
  • 关注7
  • 发帖数47
  • 社区居民
  • 忠实会员
阅读:3410回复:1

git版本冲突,我想以远程库为准。该如何做?

楼主#
更多 发布于:2016-02-13 15:20
以下是我自己做的merge,出错了。请老师指正!

$ git fetch abc master
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/test/demo
 * branch            master     -> FETCH_HEAD
   cd2b350..bb9369c  master     -> abc/master
 
 
$ git commit -a -m 'add false'
[master 98cc834] add false
 1 file changed, 1 insertion(+), 3 deletions(-)
 
 
$ git diff master abc/master
diff --git a/readme b/readme
index 6c3112c..6d27e69 100644
--- a/readme
+++ b/readme
@@ -2,6 +2,6 @@ hello
 
 hi hishenyi test
 
-today+false
+today+true
 
 oh no
 
 
$ git checkout --theirs readme
 
 
$ git commit -a -m 'add false'
On branch master
nothing to commit, working directory clean
 
 
$ git merge abc/master
Auto-merging readme
CONFLICT (content): Merge conflict in readme
Automatic merge failed; fix conflicts and then commit the result.
 
 
$ git merge master
error: merge is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.


图片:2016-02-13_151936.png

v2ex_com
校友
校友
  • UID186
  • 粉丝1
  • 关注7
  • 发帖数47
  • 社区居民
  • 忠实会员
沙发#
发布于:2016-02-13 16:21
问题已解决,找到出错原因了
以下是代码
$ git checkout --theirs readme
 
 
$ git add readme
 
 
$ git commit -m 'add false'
[master 07c5f93] add false
 
 
$ git merge abc/master
Already up-to-date.
以前我是这么写的
$ git commit -a -m 'add false'
分开写就不报错了
游客

返回顶部