☑️ useful git commands
git to gitHub command
▪️ git remote -v :
원격 저장소 설정 확인하기
git staging commands
▪️ git add [파일명] :
깃에 [파일명]파일만 staging하기
▪️ git add . :
전체 파일 깃에 staging하기
git commiting commands
▪️ git commit -m ‘[커밋 메세지]’ :
깃 커밋 하기
▪️ git commit -am ‘commit message’ :
모든 파일을 staging 하면서
‘commit message’이 커밋 메세지를 커밋하기
git pushing command
▪️ git push origin main :
main 브랜치 푸쉬
git branch managing commands
▪️ git checkout -b [브랜치명] :
브랜치 생성하고
그 브랜치로 체크아웃 하기
▪️ git checkout [브랜치명] :
현재 브랜치에서 [브랜치명] 브랜치로
체크아웃 (이동)
▪️ git branch :
생성된 깃 브랜치 확인하기
▪️ git branch -a :
생성된 원격/로컬 브랜치 모두 확인하기
▪️ git branch [브랜치명][A브랜치명] :
[A브랜치명]브랜치로 부터 [브랜치명] 브랜치를 파생시켜 새로운 브랜치 생성하기
▪️ git branch -d [브랜치명]
or git branch —delete [브랜치명] :
[브랜치명] 브랜치 삭제하기
▪️ git push origin -d [브랜치명] :
원격 [브랜치명] 브랜치 삭제하기
▪️ git branch -m [원브랜치명] [바꿀브랜치명] :
[바꿀브랜치명]으로 [원브랜치명]의 브랜치 이름을 변경하기
git merging command
▪️ git merge [브랜치명] :
현재 브랜치로 [브랜치명] 브랜치로부터
merge 하기
git pull request and merging by using 'gh' commands
▪️ gh auth login :
gh로 로그인 (자동 로그인 access_token 되어있으면 필요 없음.)
▪️ gh pr create --base main --head pull_request_branch --title "Add new feature" --body "This PR adds a new feature" :
pull_request_branch 브랜치에서
main 브랜치에게 pull request 요청
title 과 body 로 pull request 제목과 내용 기입
▪️ gh pr list :
Pull request 요청 목록 불러오기
▪️ gh pr merge [목록번호] :
[목록번호] 번호를 가지고 있는 pr merge하기
cli screen captured image
git repository url which I practiced
https://github.com/Ju-jh/git_command_practice
'📁 𝐭𝐨𝐨𝐥&𝐯𝐢𝐫𝐭𝐮𝐚𝐥𝐌𝐚𝐜𝐡𝐢𝐧𝐞 > Git & GitHub' 카테고리의 다른 글
[git] useful git delete / recover commands on cli environment (0) | 2024.06.02 |
---|---|
GitHub Repository에 내 파일 push 하는 방법 (0) | 2023.02.19 |
[Git & GitHub] 협업, merge, branch (추가작업 요망) (0) | 2023.01.13 |
[Git & GitHub] commit, 원격 repo, .gitignore (3) | 2023.01.13 |