< 깃 클론 : 레포지토리 복사 >
git clone ~
git clone -b 브랜치 이름 ~
< cd (change directory) >
< 깃허브에 새 브랜치를 생성하고 작업한 파일을 업로드하는 방법 >
로컬에서 새 브랜치 생성
# 새로운 브랜치 생성
git checkout -b 새브랜치이름
작업한 파일 스테이징 및 커밋
# 모든 변경 사항을 추가 (스테이징)
git add .
git add [파일/디렉토리 이름]
//add한 파일 모두 취소
git rm --cached -r .
//특정 파일만 add 취소
git rm --cached [파일]
# 커밋
git commit -m "작업 내용에 대한 설명"
github의 원격 저장소에 푸시
git push origin 새브랜치이름
git push -u origin main
//로컬 저장소에서 원격 저장소로 올리기
git push origin [브랜치 이름]
Repository에 'main' branch로 push하기
git init
git add [디렉토리명]
git commit -m "commit message"
git push -u origin main
원격 저장소 바꾸기
//연결된 원격저장소 있는지 확인
git remote -v
//이미 존재하는 원격저장소 삭제
git remote rm origin
//원격 저장소와 연결
git remote add origin [깃헙 레포지토리 주소]
내가 현재 있는 branch 확인하기
git branch
branch 이름 바꾸기
git branch -M [되고싶은 branch name]
git branch -m [현재 branch name] [바꾸고싶은 branch name]
branch 전환하기
git branch checkout [전환하고싶은 브랜치명]
pull
git pull origin [branch name]
git pull
'지식 창고' 카테고리의 다른 글
github 오류 해결 (0) | 2024.11.24 |
---|---|
github 2 (.gitignore , requirements.txt) (0) | 2024.11.24 |
visual stdio LNK1168 쓰기용으로 열 수 없습니다 오류 해결 (0) | 2024.09.11 |
1. 세션, 토큰, 쿠키 (0) | 2024.04.03 |