본문 바로가기
프로그래밍/git

git pull 사용법과 설명 (원격저장소 관리)

by 워킹독 2023. 6. 1.
728x90

git pull

  • 원격 저장소에서 최신 변경 사항을 가져와서 현재 작업 중인 브랜치에 병합하는 역할
  • 실제로는 git fetch와 git merge를 순차적으로 실행하는 것과 동일
  • git pull을 사용하면 원격 저장소의 변경 사항을 로컬에 업데이트하고, 자동으로 병합 작업을 수행

 

아래에 git pull 명령어의 자세한 설명과 함께 옵션

  1. git pull <remote-name> <branch-name> : 특정 원격 저장소의 특정 브랜치에서 변경 사항을 가져와서 병합
    • git pull origin main
  2. git pull --rebase <remote-name> <branch-name> : 가져온 변경 사항을 로컬 브랜치에 적용하기 전에 리베이스 작업을 수행
    • git pull --rebase origin main
  3. git pull --ff-only <remote-name> <branch-name> : Fast-forward 병합만 허용하고, Non-Fast-forward 병합은 거부
    • git pull --ff-only origin main
  4. git pull --no-commit <remote-name> <branch-name> : 변경 사항을 가져오지만, 자동으로 커밋하지 않음
    • git pull --no-commit origin main
  5. git pull --verbose <remote-name> <branch-name> : 자세한 출력을 보여줌
    • git pull --verbose origin main
  6. git pull --all : 모든 원격 저장소의 변경 사항을 가져와서 병합
    • git pull --all
  7. git pull --tags : 태그를 함께 가져옴
    • git pull --tags
  8. git pull --recurse-submodules[=yes|on-demand|no] : 하위 모듈에 대한 업데이트를 제어
    • git pull --recurse-submodules=on-demand
  9. git pull --autostash : 작업 중인 변경 사항을 일시적으로 저장하고, 가져오기 및 병합 작업을 수행한 후에 다시 적용
    • git pull --autostash
  10. git pull --no-rebase <remote-name> <branch-name> : 병합 작업을 수행할 때 리베이스를 사용하지 않고 일반적인 병합 방식을 적용
    • git pull --no-rebase origin main
  11. git pull --commit : 가져온 변경 사항을 자동으로 커밋
    • git pull --commit
  12. git pull --edit : 병합 커밋 메시지를 편집하기 위해 텍스트 편집기를 실행
    • git pull --edit
  13. git pull --no-edit : 병합 커밋 메시지를 자동으로 생성하고, 편집기를 실행하지 않음
    • git pull --no-edit
  14. git pull --verify-signatures : 원격 저장소에서 가져온 커밋의 GPG 서명을 확인
    • git pull --verify-signatures
  15. git pull --no-verify-signatures : GPG 서명 확인을 건너뜀
    • git pull --no-verify-signatures

 

이외에도 git pull 명령어에는 다양한 옵션이 존재할 수 있으며, 사용 가능한 옵션은 git pull --help 명령어를 통해 확인할 수 있습니다.

728x90
반응형

댓글