Week 11. Git & Github

BEBELOG·2022년 9월 18일
0

GIT

  • Git: 소스 코드를 효과적으로 관리하기 위한 분산형 버전관리 시스템

    소스코드가 변경된 이력을 쉽게 확인 가능
    특정 시점에 저장된 버전과 비교하거나 특정 시점으로 돌아갈 수 있음

기본용어

  • Branch : 가지치는 기능 -> 여러 작업을 동시에 진행 가능
  • Repository : 소스코드가 저장되어 있는 여러개의 Branch가 모여있는 물리적 공간
  • Checkout : 특정 시점(commit /tag)이나 branch로이동
  • Commit : 저장의 개념, 아끼지말기
  • Tag : 이정표
  • Push : local -> remote 이동 / push하면 다른 개발자들에게도 영향을 받음
  • Pull : remote -> local
  • Merge : branch끼리 합치는 과정
    confict(충돌)이 발생하는 경우, Diff를 수정해서 해결한 후 merge

Github

  • github : git을 호스팅 해주는 웹서비스, 협업을 위한 기능 제공

Local Repository

  1. Workspace 이동하고 Working Directory 생성

    cd (이동)
    mkdir (Directory 생성)

  2. git 초기화 / 해당 폴더를 깃에서 관리 시작

    git init

  3. 파일 생성

    touch *.txt

  4. 파일 확인

    ls
    git status 를 습관화해야 함.

  5. directory에서 변경된 파일을 index에 추가

    git add *.txt

  6. 변경된 사항을 head에 반영

    git commit -m "설명" *.txt

Remote Repository

  1. Create Respository

  2. 토큰 생성

  3. 등록

    git remote add origin https://"username":"token"@github.com/"repository".git

  4. 변경 내용 PUSH

    git push origin "branch"

  5. local 내용 가져오기

    git pull origin "branch"

log & diff

  1. 변경 이력 보기

    git log

2.git editor

git config --global core.editor "editorname" --wait

  1. git diff tool : 비교

    git config --global -e
    git diff "branch1" "branch2"
    git gragh 확인

merge

  1. branch 병합

    git diff "branch1" "branch2"

  2. Conflict 해제

    git add + git commit

profile
비전공자 Will be 전문가

0개의 댓글