git clone
1. 디렉토리나 File 하나만 Clone 하는 방법¶
Script¶
mkdir [Directory]
cd [Directory]
git init
git config core.sparseCheckout true
git remote add -f origin [remote-url]
echo [target-path] > .git/info/sparse-checkout
git pull origin master
Example¶
╭─deukyun@namdeug-yun-ui-Macmini ~/Desktop
╰─$ mkdir study-webrtc
╭─deukyun@namdeug-yun-ui-Macmini ~/Desktop
╰─$ cd study-webrtc
╭─deukyun@namdeug-yun-ui-Macmini ~/Desktop/study-webrtc
╰─$ git init
╭─deukyun@namdeug-yun-ui-Macmini ~/Desktop/study-webrtc ‹master›
╰─$ git config core.sparseCheckout true
╭─deukyun@namdeug-yun-ui-Macmini ~/Desktop/study-webrtc ‹master›
╰─$ git remote add -f origin https://github.com/eugenp/tutorials.git
Updating origin
remote: Enumerating objects: 334397, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 334397 (delta 0), reused 0 (delta 0), pack-reused 334396
Receiving objects: 100% (334397/334397), 354.31 MiB | 19.34 MiB/s, done.
Resolving deltas: 100% (95585/95585), done.
From https://github.com/eugenp/tutorials
* [new branch] JAVA-12714-eugen -> origin/JAVA-12714-eugen
* [new branch] fix_givenOneThreadIsWriting_whenAnotherThreadWritesAtSameKey_thenWaitAndGetCorrectValue -> origin/fix_givenOneThreadIsWriting_whenAnotherThreadWritesAtSameKey_thenWaitAndGetCorrectValue
* [new branch] master -> origin/master
╭─deukyun@namdeug-yun-ui-Macmini ~/Desktop/study-webrtc ‹master›
╰─$ echo "webrtc" > .git/info/sparse-checkout
╭─deukyun@namdeug-yun-ui-Macmini ~/Desktop/study-webrtc ‹master›
╰─$ git pull origin master
From https://github.com/eugenp/tutorials
* branch master -> FETCH_HEAD
╭─deukyun@namdeug-yun-ui-Macmini ~/Desktop/study-webrtc ‹master›
╰─$ ls
webrtc
2. Git Clone --single Branch¶
참고 자료
- https://www.slipp.net/questions/577
git clone -b {branch_name} --single-branch {저장소 URL}
ex) git clone -b javajigi --single-branch https://github.com/javajigi/java-racingcar
Last update:
February 26, 2023
Created: February 2, 2023
Created: February 2, 2023