2014-01-24 2 views
1

저장소에서 가져오고 싶습니다. 저장소와 충돌하는 저장소의 변경 집합이 더 나은 옵션이라고 믿습니다.'git pull'을 실행하여 항상 작동하고 충돌을 병합하면 변경 사항이 삭제됩니다.

병합을 처리 할 필요가 없도록하기 위해 끌어 오기를 자동화하는 방법과 내가 가져온 리포지토리가 항상 전투에서이기는 방법?

명령 줄 옵션을 살펴보면 git pull --squash이 무엇인지 찾고 있는지, 또는 어떤 종류의 병합 전략을 적용해야하는지 정확히 모르겠습니다. 나는 실제로 내가 사용해야 플래그 중 하나 인 경우 내가

-s <strategy> 
--strategy=<strategy> 

또는

-X <option> 
--strategy-option=<option> 

에 전달할 것입니다 무슨 알아낼 수 없습니다.

답변

5

theirs 옵션을 사용하여 recursive 전략을 찾고 있습니다. 망할 놈의 풀 사람이 페이지에서

git pull -s recursive -X theirs 

:

recursive 

    This can only resolve two heads using a 3-way merge algorithm. When 
    there is more than one common ancestor that can be used for 3-way 
    merge, it creates a merged tree of the common ancestors and uses that 
    as the reference tree for the 3-way merge. This has been reported to 
    result in fewer merge conflicts without causing mis-merges by tests 
    done on actual merge commits taken from Linux 2.6 kernel development 
    history. Additionally this can detect and handle merges involving 
    renames. This is the default merge strategy when pulling or merging 
    one branch. 

The recursive strategy can take the following options: 

    ours 

    This option forces conflicting hunks to be auto-resolved cleanly by 
    favoring our version. Changes from the other tree that do not 
    conflict with our side are reflected to the merge result. For a 
    binary file, the entire contents are taken from our side. 

    This should not be confused with the ours merge strategy, which does 
    not even look at what the other tree contains at all. It discards 
    everything the other tree did, declaring our history contains all 
    that happened in it. 

    theirs 

    This is the opposite of ours. 

그러나, 이것은 정말 좋은 생각이 아니다. 업스트림의 변경 사항이 정확하다고 믿더라도 충돌을 일으키지 않는 변경 사항을 어떻게 처리하는지 알 수 있습니까?

저는 직접 git pull 이상의 개인적으로 git pull --rebase을 선호하며 각 충돌하는 커밋을 하나씩 검사합니다.

+0

주의 해 주셔서 감사합니다. 일반적으로 동의 하겠지만이 특별한 시나리오에서는 자동화 도구로 인해 많은 분쟁이 발생할 것입니다. –

+0

@TrevorHickey 의미가 있습니다. 방금 누군가에게 그가 무엇을하고 있는지 모르는 사람이이 문제를 해결하기 위해 추가했습니다. – pmr