심심한 개발자의 취미생활

Git 정리

프로젝트 git / git-flow 초기화

  • git init / git flow init

원격 Repo 연결

  • git add .
  • git commit -m "commit message"
  • git branch -M main
  • git remote add origin <git origin url>
  • git push -u origin main

개발 작업 (git-flow)

  • git flow feature start <branch>
  • git add .
  • git commit -m "commit message"
  • git flow feature publish <branch>

git 상태/로그 분석

  • git status
  • git log --oneline --graph
  • git log --oneline --graph <file>

git branch 기초 관리 1

  • 조회 : git branch
  • 원격 저장소 조회 : git branch -r
  • 원격/로컬 저장소 조회 : git branch -a
  • 생성 : git branch <branch>
  • 삭제: git branch -D <branch>
  • 이름 변경 : git branch -m <old-branch> <new-branch>
  • 이동 : git checkout <branch>
  • 생성과 이동 : git checkout -b <branch>

git branch 기초 관리 2

  • 원격과 동일한 이름으로 branch 불러오기
    • git branch -t origin/<branch>
  • 원격과 다른 이름으로 branch 불러오기
    • git branch -b <new-branch> origin/<branch>
  • 원격 branch 참고하기
    • git branch origin/<branch>

git clone

  • Repo 클론
    • git clone <git repo URL>
  • private repo 클론
    • git clone https://<nickname>:<token>@<git repo URL>