mkdir mygit
cd mygit
git init
git clone <URL>
git status
git add <FILE>
git add .
#
로 시작하는 라인은 무시한다.staged 상태가 아닌 파일 비교
git diff
커밋과 staged 상태 비교
git diff --staged
git commit
기본 에디터 변경
git config --global core.editor <EDITOR>
인라인 메시지
git commit -m <MESSAGE>
스테이징 및 인라인 메시지
git commit -a -m <MESSAGE>
좋은 Commit 메시지
https://gist.github.com/robertpainsi/b632364184e70900af4ab688decf6f53
rm <FILE>
삭제한 파일 Staged 상태
git rm <FILE>
git mv <ORGION> <NEWFILE>
git log
로그 출력 변경
git config --global core.pager 'less'
git config --global core.pager ''
git log --oneline
1) vi pod.yaml 파일 생성 후
2) git add pod.yaml or .(전체 파일 add)
3) git status 상태확인
4) git config 정보 등록
git config --global user.email "ypjs09@gmail.com"
git config --global user.name "Suny-1030"
git config --global --list
5)git commit message 확인
git commit -m "create config"
#-m 으로 상태창에 진입하지 않고 바로 commit message를 작성할 수 있음
git log
git log --oneline # 한줄로 로그 확인 가능
6) 이전 버전으로 돌아가기
git checkout
7) 최근 상태로 돌아가기
git checkout master
8) 파일명 변경
git mv pod.yaml mypod.yaml
9) 기존 commit mesage 사용
git commit --amend
HEAD -> 바라보는 곳
10) branch 이용
git branch dev1
git checkout dev1
git log
11) branch dev1 에서 새로운 yaml파일을 구성하여 add/commit
git log --oneline --graph #변경된 HEAD의 위치를 확인
12) branch 삭제
git branch -d dev1
git branch -D dev1 # 강제삭제
13) branch 생성
git checkout -b dev2 # 없는 branch 생성 후 이동
14) git 병합
git merge dev2
merge의 충돌
다른 branch에서 같은 파일의 같은 라인을 수정 하여 병합하면 충돌이 일어남
15) branch name 변경하기
git branch -M main #사용중일 때는 m 을 못씀
16) remote 하기
git remote add origin https://github.com/Sunny-1030/effective-eureka.git
17) push 하기
git push -u origin main
username sunnuy-1030
password *****
(만약 이중인증이면 토큰 발급을 해야함)
만약 github에서 직접 수정을 하면
(fetch -> fast-forward)
git fetch origin
18) fast-forward
git merge origin/main
(fast-forward)
github 협업시
세팅 -> collaborators -> add people
(많은 collaborator는 x)
Fork -> 다른사람의 레포지터리를 가져올 수 있다
19) tag 생성
git tag -a 'v0.1' -m 'Version 0.1'
git tag -l
git push origin v0.1
20) ssh key 등록하기
ssh-keygen
cat id_rsa.pub 복사
github에 붙여넣기