브랜치 병합
Git merge 명령 을 사용하여 여러 브랜치를 통합할 수 있습니다.
아래 상황을 고려하십시오. 두 개의 브랜치가 있습니다. main
브랜치에서 나오는 몇 가지 커밋이 있는 bugfix
브랜치입니다.

이 경우 bugfix
를 다시 main
으로 병합하는 것은 큰 문제가 아닙니다. bugfix
가 생성된 이후로 main
이 변경되지 않았기 때문입니다. Git은 main
위치를 bugfix
의 최신 위치로 이동하여 이를 병합합니다. 이 병합을 fast-forward
라고 합니다.

그러나 아래 예에서는 bugfix
가 브랜치된 이후 main
이 여러 번 업데이트되었습니다. 이 두 브랜치에서 병합이 실행될 때 bugfix
및 main
의 변경 사항을 결합해야 합니다.

이러한 종류의 병합을 위해 merge commit
이 생성되고 main
위치가 새로 생성된 병합 커밋으로 업데이트됩니다.

fast-forward 병합이 가능한 경우에도 fast-forward 병합 없이 병합하도록 명시적으로 강제할 수 있습니다.

위에 표시된 것처럼 fast-forward가 아닌 병합은 bugfix
브랜치를 그대로 둡니다. 이렇게 하면 기능 브랜치 bugfix
에 대한 명확한 그림을 얻을 수 있습니다. 기능 브랜치가 시작하거나 끝나는 위치를 쉽게 찾고 기능 브랜치에 대한 변경 사항을 추적할 수 있습니다.