<git 함께 작업 workflow>

윤장원·2022년 5월 1일
0

Git

목록 보기
2/2

<git 함께 작업 workflow>

  1. git init
    -기존 디렉토리를 Git Repository로 변환(Local Repository 생성)

  2. git remote add
    -Local Repository를 Remote Repository와 연결하여 원격으로 관리
    -내 Github에 Repository 생성하고
    git remote add origin <Repository 주소>
    -다른 사람과 연결 >
    git remote add pair <Repository 주소>

  3. git remote -v
    -Local Repository와 연결된 모든 Remote Repository 목록 확인

  4. pull
    -페어가 master 브랜치에 작업한 코드를 올려서 확인하고 싶을때 Remote Repository의 해당 branch 내용을 Local Repository로 가져오기
    -받아오는 내용은 자동으로 병합(merge)
    -git pull pair master

  5. conflict
    -페어와 내가 동일한 라인을 수정한 파일이 있을 때 충돌 발생, merge 실패
    -git status > 어떤 파일이 충돌하고 있는지 확인
    -파일을 열어
    "Accept Current Change" 로 내가 수정한 내용으로 파일에 반영
    "Accept Incoming Change" 로 Remote Repository의 내용으로 파일에 반영
    "Accept Both Changes" 로 변경 사항 모두 반영
    -충돌한 파일 수정 후, Remote Repository에 업로드하기 위해 staging area에 파일 추가

    git add .
    git commit
    git push origin master

0개의 댓글