File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
10
10
11
11
For a steady stream of TILs, [ sign up for my newsletter] ( https://tinyletter.com/jbranchaud ) .
12
12
13
- _ 1080 TILs and counting..._
13
+ _ 1081 TILs and counting..._
14
14
15
15
---
16
16
@@ -227,6 +227,7 @@ _1080 TILs and counting..._
227
227
- [ Cherry Pick A Range Of Commits] ( git/cherry-pick-a-range-of-commits.md )
228
228
- [ Clean Out All Local Branches] ( git/clean-out-all-local-branches.md )
229
229
- [ Clean Up Old Remote Tracking References] ( git/clean-up-old-remote-tracking-references.md )
230
+ - [ Clone A Repo Just For The Files, Without History] ( git/clone-a-repo-just-for-the-files-without-history.md )
230
231
- [ Clone A Repo Locally From .git] ( git/clone-a-repo-locally-from-git.md )
231
232
- [ Configure Global gitignore File] ( git/configure-global-gitignore-file.md )
232
233
- [ Configuring The Pager] ( git/configuring-the-pager.md )
Original file line number Diff line number Diff line change
1
+ # Clone A Repo Just For The Files, Without History
2
+
3
+ Though the history of a Git repository is a huge part of its value, sometimes
4
+ you just want a copy of the files for the current state of the main branch.
5
+
6
+ Using the ` --depth ` flag with ` git-clone ` allows you to clone a repo without
7
+ its history. You can do that with a depth of ` 1 ` which will clone the top of
8
+ the tree and exclude all the past history.
9
+
10
+ ``` bash
11
+ $ git clone --depth 1 git@github.com:jbranchaud/til.git
12
+ ```
13
+
14
+ If you do a ` git log ` after this, you'll see there is only one commit in the
15
+ history. Depending on the size and history of the repo, you may notice that the
16
+ clone is quicker than one that includes the full history.
17
+
18
+ See ` man git-clone ` for more details.
You can’t perform that action at this time.
0 commit comments