<aside> ⚙

Github와 Gitlab은 약간의 차이가 있기 때문에 각 사용법에 차이가 있음 → 이 문서는 Github 기준으로 작성됨

[목차]

우리 프로젝트 Git Flow 전략

✅ Amend

✅ Cherry-Pick

✅ Squash and Merge

✅ Pull Request

✅ Rebase

</aside>

우리 프로젝트 Git Flow 전략

  1. 작업 branch는 main branch base로 생성

    /feature/#{git_project}_{description}
    
  2. 작업 완료 후 dev branch로 merge

  3. Squash가 필요하다면 진행 → 필요 없다면 생략 가능

    ✅ Squash and Merge

  4. dev 환경에서 테스트 완료 후 main으로 PR → ‘작업 branch’ into ‘main’

    ✅ Pull Request

  5. prod 환경에서 테스트

  6. 배포 완료 후 dev branch 동기화

    1. delete Local 'dev' branch
    2. New **dev** branch from 'main'
    3. delete Remote 'dev' branch
    4. push Local 'dev' branch to Remote
    

✅ Amend

<aside> ❓

checkout된 branch의 마지막 commit에 수정 사항을 덮어 씌울 수 있는 기능

</aside>

  1. commit list 에서 원하는 Changes 선택
  1. commit message 작성
  2. commit message 상단의 Amend 선택
  3. Changes 아래에 마지막 commit id d87d37ca때 수정된 파일 노출 확인
  4. Ammend Commit 버튼 클릭
  1. 기존 commit line 의 변경된 ac544a80 commit id 확인
  1. Remote 에 적용된 d87d37ca로 인한 pull 1건, 신규 적용된 ac544a80 push 1건 Local branch 에서 확인
  2. d87d37ca가 아닌 ac544a80이 적용되어야 하므로 Force Push 진행
  3. Remote branch ac544a80 확인
# force push 명령어
git push -f