본문 바로가기
Infra/Git

Git one-sided merge

by Pinocchio 2022. 6. 7.

git merge 시 conflict가 발생할 때, 한쪽 branch를 그대로 따라가고 싶은 경우 (일방적으로 덮어쓰고 싶은 경우)

git merge -Xours targetBranch   //  현재 브랜치 기준으로 덮어씀 ( ours 우리 소스를 쓸게! use our sources)

git merge -Xtheirs targetBranch //  타겟 브랜치 기준으로 덮어씀 ( theirs 걔네 소스를 쓸게! use thier sources)

 

Ref. https://engineer135.tistory.com/166

 

git merge 덮어쓰기(overwrite)

머지할때 한쪽 소스로 덮어쓰는 법 git merge -Xours targetBranch 현재 브랜치 기준으로 덮어씀 ( ours 우리 소스를 쓸게! use our sources) git merge -Xtheirs targetBranch  타겟 브랜치 기준으로 덮어씀 ( t..

engineer135.tistory.com

Ref. https://git-scm.com/book/ko/v2/Git-%EB%8F%84%EA%B5%AC-%EA%B3%A0%EA%B8%89-Merge

 

Git - 고급 Merge

Merge 작업할 때 공백 처리 옵션을 사용하면 Git이 꽤 잘해준다. 하지만, Git이 자동으로 해결하지 못하는 때도 있다. 이럴 때는 외부 도구의 도움을 받아 해결한다. 예를 들어 Git이 자동으로 해결해

git-scm.com

 

'Infra > Git' 카테고리의 다른 글

Git pull할 때 conflict 발생할 경우  (0) 2022.06.23
Git remote branch 가져오기  (0) 2022.06.23
삭제한 stash 복구하는 방법  (0) 2022.06.20
git 변경 사항 확인하기  (0) 2022.05.20
git branch 지우기  (0) 2022.05.19

댓글