GitHub push와 pull

Hyuk2·2023년 10월 31일
0

github

목록 보기
3/4
post-thumbnail

- local 저장소 파일을 remote 저장소로 커밋 밀기

git push -u origin(remote) main(branch)

- remote 저장소 파일을 local 저장소로 커밋 당기기

git pull origin(remote) main(branch)

- [충돌] pull 할 것이 있는데, push를 먼저하는 경우

  • push를 해보면 error: failed to push some refs to '원격 저장소 주소' 오류 문구가 나온다.

  • pull을 먼저 해서, remote 저장소 파일을 받아온 다음에 push를 하면 된다.

- pull하는 두 가지 방법

git pull --no-rebase (remote) (branch) -> merge 방식
git pull --rebase (remote) (branch) -> rebase 방식(협업시 사용가능)

- local 저장소 파일을 강제로 remote 저장소에 커밋 밀기

git push --force

profile
끝까지 하는 사람

0개의 댓글