git충돌( git-conflict)

김선주·2022년 1월 23일
0

git conflict는 commit한만큼 난다.................
git에서 각자의 branch를 만들고 작업한 pull request하면 conflict가 나는 경우가 있다. pull origin master후 다른 branch에서 같은 라인을 수정하고, 수정한 내용을 master에 merge했을 때 발생한다. 충돌된 코드를 수정해야 pull request를 할 수 있다.

1. git checkout master
master branch로 이동

2. git pull origin master
최신 업데이트된 remote master 저장소의 데이터를 local master로 저장해 local master를 최신화합니다.

3. git checkout (충돌난 branch)
충돌난 branch로 이동해서

4. git merge master
이 branch와 최신버전의 local master데이터를 merge해줍니다.
(이때, 다른 branch에서 최신 수정해놓은 데이터와 내가 수정한 branch가 충돌합니다.) 충돌시 편집창에 들어가 해당파일 수정

5. 다시 pr (git add -> git commit -> git push origin feature/(branch)

git conflict는 commit한만큼 난다.................

profile
김선주입니다.

0개의 댓글