Tuesday, November 1, 2011

GIT 충돌 해결

GIT 사용중 충돌 발생한 경우.

$ git pull

From xxxx

4cb74b1..d6ca118 master -> origin/master

Auto-merging xxx.xcodeproj/project.pbxproj

CONFLICT (content): Merge conflict in xxx.xcodeproj/project.pbxproj

Automatic merge failed; fix conflicts and then commit the result.

$ git status

# On branch master

# Your branch and 'origin/master' have diverged,

# and have 5 and 1 different commit(s) each, respectively.

#

# Unmerged paths:

# (use "git add/rm <file>..." as appropriate to mark resolution)

#

#        both modified: xxx.xcodeproj/project.pbxproj

#

충돌난 파일을 에디터로 열고 충돌을 해결한다.

그리고 커밋을 하면 아래 에러가 발생하고 커밋을 할 수 없다.

충돌난 파일을 git add 로 다시 추가하여도 동일한 에러가 발생한다.

Devs-MacBook-Pro:paperble_app dev$ git commit .

fatal: cannot do a partial commit during a merge.

이러한 경우 -i 옵션을 주면 stage에 되지 않은 파일을 커밋할 수 있다.

$ git commit . -i

http://dready.org/blog/2010/04/28/git-conflict-resolution/

No comments:

Post a Comment