충돌 만들기
충돌이 발생하면 이를 해결하여 작업을 완료해야 합니다. 이 단계에서는 “tutorial” 및 “tutorial2” 두 개의 기존 저장소를 사용하여 의도적으로 충돌을 만들 것입니다.
먼저 tutorial
디렉터리에서 sample.txt
파일을 엽니다. 아래의 굵은 텍스트를 파일에 추가하고 커밋합니다.
Anyone can learn Git with this tutorial and Backlog
add: Register a change in an index
commit: Save the status of an index
![Record the status of commit index](/static/4e9a8f49ec25d1845324f70ea1eab76b/5a190/01.png)
다음으로, tutorial2
디렉터리에서 sample.txt
파일을 엽니다. 아래의 굵은 텍스트를 파일에 추가하고 커밋합니다.
Anyone can learn Git with this tutorial and Backlog
add: Register a change in an index
pull: Obtain the content of the remote repository
![pull Acquire the contents of a remote repository.](/static/872e42c66e37b3235eba483a2d018be7/5a190/02.png)
이제 tutorial2
의 변경 사항을 원격 저장소로 푸시합니다.
![Push to the remote repository](/static/16e668f363254db234adcd68f556befa/5a190/03.png)
현재 원격 저장소에서 sample.txt
파일에는 세 번째 라인인 pull: Obtain the content of the remote repository
가 포함되어 있으며 기록 로그에 커밋되었습니다.
다음으로, tutorial
저장소에서 원격 저장소로 커밋을 푸시할 것입니다.
![Git raises a conflict and rejects your push](/static/aad1db1136d67488d3905f317fd9b91f/5a190/04.png)
보시다시피 Git은 충돌을 일으키고 푸시를 거부합니다.