Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

melius

[Git] 명령어 본문

et cetera

[Git] 명령어

melius102 2020. 10. 25. 08:47

$ git --version 버전확인

 

$ git init 폴더 초기화

$ git init --help 명령어(init) 도움말

 

https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup

$ git config --global user.name "John Doe"

$ git config --global user.email johndoe@example.com

 

$git clone https://github.com/libgit2/libgit2 원격 저장소를 로컬에 복사하기

 

https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes

$ git remote -v

 

https://git-scm.com/book/en/v2/Git-Branching-Branch-Management

https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell

$ git branch 로컬 브랜치 보기

$ git branch -r 원격 저장소의 브랜치 보기

$ git branch -a 로컬/원격 저장소의 브랜치 모두 보기

$ git branch testing 브랜치 만들기 (복사할 브랜치에서)

$ git branch -d testing 브랜치 삭제

 

$ git remote update 원격 브랜치 갱신

 

$ git checkout testing 브랜치 이동

$ git checkout -t origin/testing 원격저장소의 testing 브랜치 가져오기(같은 이름)

$ git checkout -b testing2 origin/testing 원격저장소의 testing 브랜치 가져오기(다른 이름)

 

$ git add . 모든 변경된 파일 Stage 하기

 

$ git commit -m "commit message" 커밋하기

 

$ git checkout -b testing2 origin/testing 원격저장소의 testing 브랜치 가져오기(다른 이름)

 

https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches

$ git push origin testing 브랜치 푸쉬 (해당 브랜치만 푸쉬)

 

https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes

$git fetch origin 원격 저장소(origin)의 모든 branch의 정보를 가져옴

 

$ git pull origin master 가져오고 병합

$ git pull origin testing 가져오고 병합 (현재 브랜치와 testing이 병합)

 

$ git status 폴더 상태확인

 

$ git log 커밋 리스트 보기

 

$ git reset --hard abcd1234 과거로 돌아가기

$ git reset --soft abcd1234 과거로 돌아가기

 

 

추적 브랜치

git branch --set-upstream-to origin/myBranch	// 추적 (원격)브랜치 설정
git branch -vv					// 추적 (원격)브랜치 확인
git branch --unset-upstream			// 추적 (원격)브랜치 해제

 

$ git merge master 로컬 master을 현 브랜치에 병합하기 (현 브랜치가 변함)

 

$ git rm file.name -f git에서 파일 추적을 해제하고, 파일 삭제

$ git rm file.name --cached git에서 파일 추적을 해제 (파일 남음)

 

 

'et cetera' 카테고리의 다른 글

[MongoDB] Document Database  (0) 2021.04.10
[Mac] 주요 명령어  (0) 2020.11.22
[Chrome] 유용한 기능  (0) 2020.09.01
[CMD] 파일검색  (0) 2020.08.17
[VS Code] Django pylint(no-member) error  (0) 2020.07.10
Comments