[Git] GitHub pull request template 만들기

    1. 시작하며

    GitHub 를 사용하여 프로젝트를 진행한다면 커밋 내역을 Pull Request 하고 팀원들과 코드 리뷰하는 시간을 가지게 된다. 덕분에 코드를 merge 하기 전에 변경 사항에 대해 검토하고 팀원들과 의견을 나눌 수 있다.

     

    이 때 pull request template을 작성해두면 Pull Request 마다 자동으로 템플릿을 내용을 PR body에서 확인 할 수 있다.

    2. 왜 pull request template이 필요한가

    • PR의 description 형식을 표준화 할 수 있다.
    • 잘 작성한 PR 은 리뷰어로 하여금 코드 이해를 돕고 시간을 절약 할 수 있게 한다.
    • PR을 요청한 개발자 역시 PR template을 작성하면서 한번 더 코드를 체크 할 수 있다.

    3. GitHub pull request template 추가 하기

    아래와 같이 PR template 이 자동설정 될 수 있도록 pull request template 을 추가해보자.

     

    pull_request_template.md 파일 생성

    pull_request_template.md 생성한다. 이 때 pull_request_template.md 은 Base repository 에 있어야 적용되며 대소문자를 가리지 않는다.

     

    root directory, the docs directory, .github directory 아래 중 한 곳에 생성하면 된다.

    • .github/pull_request_template.md
    • docs/pull_request_template.md
    • root directory 아래 /pull_request_template.md

    필자는 .github 아래에 만드는 것을 선호한다.

     

    이미지 출처 : https://docs.github.com

    템플릿 작성하기

    pull_request_template.md 내용을 작성한다.

    간단한 작성 예

    아래와 같이 필수적인 정보만 기입해도 된다. 필자 역시 현 프로젝트에서 요약, 변경 내용, Jira 번호 및 URL 정도만 기입하여 PR template을 활용 중이다.

    ## Summary
    
    ## Describe your changes
    
    ## Issue number and link

    Angular 의 pull request template 예

    참고용으로 Angular 의 pull request template을 확인해보자.

    PR Checklist와 PR Type 을 정의하여 PR을 요청하는 개발자도 한번 더 본인의 코드를 확인할 수 있도록 해두었다.

    ## PR Checklist
    Please check if your PR fulfills the following requirements:
    
    - [ ] The commit message follows our guidelines: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit
    - [ ] Tests for the changes have been added (for bug fixes / features)
    - [ ] Docs have been added / updated (for bug fixes / features)
    
    
    ## PR Type
    What kind of change does this PR introduce?
    
    <!-- Please check the one that applies to this PR using "x". -->
    
    - [ ] Bugfix
    - [ ] Feature
    - [ ] Code style update (formatting, local variables)
    - [ ] Refactoring (no functional changes, no api changes)
    - [ ] Build related changes
    - [ ] CI related changes
    - [ ] Documentation content changes
    - [ ] angular.io application / infrastructure changes
    - [ ] Other... Please describe:
    
    
    ## What is the current behavior?
    <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
    
    Issue Number: N/A
    
    
    ## What is the new behavior?
    
    
    ## Does this PR introduce a breaking change?
    
    - [ ] Yes
    - [ ] No
    
    
    <!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
    
    
    ## Other information

    4. 마치며

    프로젝트원들과의 합의하에 자유롭게 템플릿을 작성하여 PR 을 효율적으로 관리 할 수 있다. 이를 통해 시간과 노오력을 절약할 수 있다. 물론 휴먼에러 방지에도 도움이 된다.

     

    Issue 역시 template으로 관리 할 수 있는데 다음에 확인해보자.

    5. 참고

    반응형

    댓글

    Designed by JB FACTORY