Post

Git push, commit, merge error

branch 생성하기

1
 git checkout -b comment

branch 옮기기

1
 git checkout comment

commit, push

1
2
3
4
git add .
git commit -m "바꾼내용"
git push

how to merge

보통은 pull request하면 되지만 머지가 안 되는 경우

❌ Cannot automatically merge

먼저 develop에 commit branch를 머지하였고 이후 post branch를 머지하려고 했더니 Cannot automatically merge에러가 떴다. post입장에서는 자기가 만들어졌을 때 develop의 모습과 commit branch가 머지된 현재의 develop 모습이 너무 다르기 때문이다. 이럴 때 해결방법은 다음과 같다.

  1. 먼저 post branch를 개발한 사람의 컴퓨터에서 develop으로 체크아웃한다.
1
git checkout develop
  1. develop에서 pull을 통해 바뀐 develop의 내용들을 가져온다.
1
git pull origin develop
  1. 다시 post branch로 체크아웃한다.
1
git checkout post
  1. 그러면 다시 develop으로 merge했을 때 오류없이 머지가 가능하다.
1
git merge develop
  1. 문제가 생기면 코드 수정
1
2
3
git add .
git commit -m “merge error fix”
git push
  1. 다시 pull request하면 문제없이 merge 가능!
This post is licensed under CC BY 4.0 by the author.