2012-11-09 1 views
3

의 이름을 변경 병합 나는 시도하고 마스의 변경에 끌어 때 지금자식 나는 기존의 지점에서 새로운 지점을 만든 충돌

git co master 
echo "Some changes" >> fooNew.txt 
git commit -am "Do some important changes" 
git push origin master 

: 마스터 분기에 fooNew.txt 및 변경 내용을 밀어 TER 나는 오류가 발생 :

CONFLICT (modify/delete): fooNew.txt deleted in HEAD and modified in master. 
나는 마스터에 fooNew.txt에 수행 된 변경을 포함해서 foo.txt 파일로 끝날 수 있도록 나는이 두 가지를 병합하는 방법을

?

+1

'git pull '명령 전에'master'에'test'를 병합 했습니까? 그렇지 않다면,'master'를'test'에 병합하고, 충돌을 해결 한 다음,'master'에 다시 병합하십시오. 이미 병합 된 경우 마스터를 이전 커밋으로 되돌려 놓아야합니다. – JScoobyCed

+1

리베이스를 시도 했습니까? 'git pull --rebase origin master' – iltempo

+0

고마워, 나는'git pull --rebase origin master'를 시도하고 master에 테스트를 먼저 병합했지만 여전히 같은 문제가 발생한다. foo.txt 파일을 삭제하거나 삭제하십시오. 나는 또한 테스트하지만 운이없는 마스터 rebasing 시도했습니다 ... – tempestSA

답변

0

귀하의 방법을 사용하면 문제가 없습니다.

$ git checkout -b test 
Switched to a new branch 'test' 

$ git mv foo.txt fooOld.txt 

$ git mv fooNew.txt foo.txt 

$ git commit -am "Rename file" 
[test bf82f6d] Rename file 
1 files changed, 0 insertions(+), 0 deletions(-) 
rename fooNew.txt => fooOld.txt (100%) 

$ git checkout master 
Switched to branch 'master' 

$ echo "Some changes" >> fooNew.txt 

$ git commit -am "Do some important changes" 
[master 653c0df] Do some important changes 
1 files changed, 1 insertions(+), 0 deletions(-) 

$ git checkout test 
Switched to branch 'test' 

$ git merge master 
Auto-merging fooOld.txt 
Merge made by the 'recursive' strategy. 
fooOld.txt | 1 + 
1 files changed, 1 insertions(+), 0 deletions(-)