본문 바로가기

공부기록/etc

git 명령어 cheat sheet

이미 존재하는 디렉토리에 원격 저장소 연결하기

git init
git remote add origin [ github clone URL ]

내가 현재 작업하고 있는 branch가 master를 바라보고 있게 해주는 명령

push 할 때는 내 branch로 올라가지만, pull 받을 때는 main에서 받게 된다.

git branch --set-upstream-to=origin/main

다른 사람의 PR을 내 local에서 보기

git clone [ github clone URL ]
git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"
git fetch origin
git checkout -t origin/pr/1

'공부기록 > etc' 카테고리의 다른 글

[linux] diff 명령어 -u 옵션 결과 해석하기  (0) 2020.04.24