GIT-LFS-CLONE(1)

✨ GIT-LFS-CLONE ✨

okay so bestie, this is a git-lfs manual page, and today's main character is git-lfs-clone β€” the one that slides into your DMs to clone a LFS-enabled repo without making you wait forever πŸ’…


🌸 NAME 🌸

git-lfs-clone β€” clone a LFS-enabled repository, but like… efficiently πŸš€

πŸŽ€ SYNOPSIS πŸŽ€

git lfs clone [git clone options] <repository> [<directory>]

πŸ’– DESCRIPTION πŸ’–

So here's the tea β˜•: this command clones an LFS enabled Git repository way more efficiently by disabling LFS during the git clone, and then immediately doing a git lfs pull right after. Two-step glow-up, no cap ✨

It also installs all of the repo-level hooks (.git/hooks) that LFS needs in order to operate β€” like, it's not just cloning, it's setting up the whole vibe. And if you pass --separate-git-dir, those hooks get installed there instead. iykyk 🫢

Why is this faster than a regular git clone, you ask? Because a regular one downloads LFS content using the smudge filter, which runs individually per file in the working copy 😭 that's lowkey inefficient compared to the batch mode and parallel downloads that git lfs pull does. It's giving "one person at the register" vs. "twelve lanes open at Target." πŸ›’πŸ’¨

⭐ OPTIONS ⭐

  • all options supported by git clone β€” yeah, literally every single one, they all work here, go wild πŸ‘‘
  • -I <paths>, --include=<paths> β€” see INCLUDE AND EXCLUDE down below, bestie πŸ‘‡
  • -X <paths>, --exclude=<paths> β€” also see INCLUDE AND EXCLUDE πŸ‘‡
  • --skip-repo β€” skip installing the repo-level hooks (.git/hooks) that LFS requires. It's disabled by default, so this is you actively opting out. Bold move, respect πŸ’€

πŸ¦‹ INCLUDE AND EXCLUDE πŸ¦‹

okay so you can configure Git LFS to only fetch objects that satisfy references in certain paths of the repo, and/or exclude certain paths, so you're not wasting your precious time downloading stuff you literally do not use. self-care fr fr 🌸

In your Git configuration or in a .lfsconfig file, you can set either or both of lfs.fetchinclude and lfs.fetchexclude to comma-separated lists of paths. Here's the vibe check on how that works:

  • If lfs.fetchinclude is defined, Git LFS objects will only be fetched if their path matches one in that list πŸ”₯
  • If lfs.fetchexclude is defined, Git LFS objects will only be fetched if their path does not match one in that list πŸ™ˆ

Paths are matched using wildcard matching as per gitignore(5). iconic behavior.

heads up bestie πŸŽ€ using the command-line options -I and -X overrides the respective configuration settings. And setting either option to an empty string clears the value. so don't be surprised when your config gets ghosted πŸ‘»

🌈 SEE ALSO 🌈

git-clone(1), git-lfs-pull(1), gitignore(5).

Part of the git-lfs(1) suite. you know, the whole fam 🫢


and that's the whole page, bestie β€” no crumbs left behind πŸ’… this was GIT-LFS-CLONE(1) from the git-lfs suite, and the date on this beauty is the GIT-LFS-CLONE(1) footer situation at the bottom, so go forth and clone efficiently βœ¨πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from