충돌 만들기
충돌이 발생하면 이를 해결하여 작업을 완료해야 합니다. 이 단계에서는 “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/b683470b31a40f86391522436697d1b3/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/7634cb44e65f530824997885febac9df/5a190/02.png)
이제 tutorial2
의 변경 사항을 원격 저장소로 푸시합니다.
![push the change from tutorial2 to the remote repository](/static/96503b68a6f01c7714013b58f2086bbf/5a190/03.png)
현재 원격 저장소에서 sample.txt
파일에는 세 번째 라인인 pull: Obtain the content of the remote repository
가 포함되어 있으며 기록 로그에 커밋되었습니다.
다음으로, tutorial
저장소에서 원격 저장소로 커밋을 푸시할 것입니다.
![Git raises a conflict and rejects your push](/static/1e6b63890ffd7b427601832462f7a7c1/5a190/04.png)
보시다시피 Git은 충돌을 일으키고 푸시를 거부합니다.