본문 바로가기
Developer/Git

git clone 명령어 사용 방법 및 특징

by 아우럼 2024. 9. 22.
반응형

git clone 명령어는 원격 저장소의 내용을 로컬 컴퓨터로 복제하는 데 주로 사용합니다.

 

git clone 명령어 설명

  • git clone 명령어는 프로젝트 시작할 때 처음에 한 번은 꼭 사용하는 명령어입니다.
  • git clone 명령어 이후 원격 저장소와 연결해서 사용할 때는 remote add 명령어를 사용합니다.
  • git remote add 명령어는 링크를 참고하세요.  https://aurumguide.tistory.com/112
  • 원격 저장소에 있는 commit 이력 정보도 복제할 수 있습니다.

git clone 명령어 설명.
git clone 명령어 설명.

git clone 사용 방법

1. 원격 저장소의 전체를 복제하는 방법.

git clone <원격 저장소 URL>

PS D:\gitremoteadd> git clone https://github.com/username/repository.git

2. 원격 저장소의 10개 이력까지만 복제하는 방법.

git clone --depth 10 <원격 저장소 URL>

PS D:\gitremoteadd> git clone --depth 10 https://github.com/username/repository.git

3. 저장소의 특정 branch 복제하는 방법.

git clone -b <브랜치 이름> <원격 저장소 URL>

PS D:\gitremoteadd> git clone -b addbranch https://github.com/username/repository.git

4. 저장소의 특정 디렉터리만 복제하는 방법.

git clone <원격 저장소 URL> <디렉터리 이름>

PS D:\gitremoteadd> git clone https://github.com/username/repository.git aurumguide

 

 

반응형