Skip to content

Commit 406cd29

Browse files
committed
Add Clone A Repo Just For The Files, Without History as a git til
1 parent 8ffa0c3 commit 406cd29

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
1212

13-
_1080 TILs and counting..._
13+
_1081 TILs and counting..._
1414

1515
---
1616

@@ -227,6 +227,7 @@ _1080 TILs and counting..._
227227
- [Cherry Pick A Range Of Commits](git/cherry-pick-a-range-of-commits.md)
228228
- [Clean Out All Local Branches](git/clean-out-all-local-branches.md)
229229
- [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)
230231
- [Clone A Repo Locally From .git](git/clone-a-repo-locally-from-git.md)
231232
- [Configure Global gitignore File](git/configure-global-gitignore-file.md)
232233
- [Configuring The Pager](git/configuring-the-pager.md)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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.

0 commit comments

Comments
 (0)