보통은 default가 Create a merge commit 이기 때문에 아무 생각없이 이 방식으로 머지했으나, 저 옆에 화살표를 눌러보면, 2가지의 옵션이 더 있다!
이렇게 3가지 정도의 Git PR merge 전략이 있다고 할 수 있다. 각 전략의 장단점을 한번 알아보자!
develop -> feature/store, feature/benefit, feature/do
이런 상황에서 각 브랜치가 전부 develop에 머지가 되었을 때?
결국, commit들의 순서와 merge의 순서가 완전히 달라져 버림!
squash : 으깨다, 으끄러지다
merge가 된 순서대로 기록이 됨
merge가 된 PR의 commit들이 합쳐져서 (squashed) 기록이 됨
세세한 commit들이 합쳐져서 하나의 commit으로 남음
merge가 된 순서대로 기록이 됨 (각각의 commit도 PR이 머지된 순서대로)
'Merge' 로그는 남지 않음
rebase로 인해, merge 이후 로그를 보면 하나의 브랜치에서 작업한 것과 같은 로그
따라서, 작은 단위의 roll-back도 가능!
git checkout feature/store
git rebase develop
Rebase and merge (Github)
원래 이전에 있었던 commit도 새로운 commit(hash)로 들어오게 됨
git rebase
원래 이전에 있었던 commit은 이전의 commit(hash)로 들어오게 됨
The rebase and merge behavior on GitHub deviates slightly from git rebase. Rebase and merge on GitHub will always update the committer information and create new commit SHAs, whereas git rebase outside of GitHub does not change the committer information when the rebase happens on top of an ancestor commit. For more information about git rebase, see git-rebase in the Git documentation.
If you have linear history requirement enabled on any protected branch, you must enable squashing or rebasing.
만약 linear하게 히스토리를 관리하고 싶다면, squashing이나 rebasing 전략을 enable 시켜라!!
develop
release/v.X.X.X
feature/manbogi
feature/team-league
feature/race
(거의) 모든 merge를 create a merge commit 방식으로.
다음과 같이 해보면 어떨까?
여기서 하나 더 제안해보자면, 특히 QA 이슈 대응을 할 때에
fix/manbogi-issue-gina-1, ... fix/manbogi-issue-gina-11, ...
브랜치 관리가 잘 안되고 있는듯한 느낌이 든다.
rebase and merge는 개인적으로 신경써줘야할게 너~무 많은 느낌!
(하지만... github에서 제공해주는 옵션들을 잘 찾아보면 괜찮나..?)
나중에 여유가 생기고, 모두가 rebase 및 PR, commit에 대한 단위 얼라인이 된다면 써볼 수도 있지 않을까 기대도 됨!
참고한 링크
Feedback
좋아요랑 구독했습니다