[N411] git, 개발환경

쥬쥬스·2023년 3월 24일
0

section4

목록 보기
4/15

수업내용

git 연습

혼자 작업

  1. 레파지토리 가져오기 git clone 주소
  2. 상태 확인 git status
  3. staging area로 이동 git add 파일이름
  • 전부 넘기기 git add .
  1. commit git commit -m '내용'
  • 안남길 때는 git commit
  1. commit 취소 git reset HEAD^
  2. push git push origin main
  • origin 리파지토리의 main으로 푸쉬
  1. commit log 확인 git log

함께 작업

  1. git 연결 git init
  • local을 git으로 관리
  • 초기화 시킨다는 뜻. git init을 하지 않으면 git add, commit등 사용 불가
  • 이 디렉토리에서 git을 사용한다는 의미
  1. 리모트 연결 git remote add origin 주소
  • origin 이름으로 내 remote repository 등록
  1. push git push origin main
  • main에서 origin remote repository로 전달
  1. 리모트 연결 git remote add pair 주소
  • pair라는 이름으로 local에 등록
  1. 리모트 확인 git remote --verbose
  2. pull git pull pair main
  • fetch 가져오기 + merge 합치기 = pull 명령어
  1. push git push origin main
  2. 작업 staging area에 업로드 git add 파일
  3. commit git commit -m '내용'
  4. pull git pull pair main
  5. add git add 파일
  6. commit git commit
  7. 로컬 내용 반영 git push origin main

브랜치

  1. 브랜치 생성 git checkout -b 브랜치이름
  • checkout은 옵션이 중요
  1. 브랜치 목록 git branch
  2. 브랜치 생성 git checkout -b 브랜치이름
  3. 브랜치 이동 git checkout 브랜치이름
  4. 브랜치 병합 git merge 브랜치이름
  5. push git push origin 브랜치이름
  6. 작업 임시 저장 git stash
profile
느려도... 꾸준히.....🐌

0개의 댓글