yadm-clone
Clone yadm managed dotfiles repository
TLDR
Clone an existing repository
Clone an existing repository, then execute the bootstrap file
Clone an existing repository and after cloning, do not execute the bootstrap file
Change the worktree that yadm will use during cloning
Change the branch that yadm gets files from
Override an existing repository local branch
SYNOPSIS
yadm clone [options] <repository> [<directory>]
PARAMETERS
<repository>
The URL (e.g., SSH, HTTPS) or local path to the Git repository containing your dotfiles. This is a mandatory argument.
[ <directory> ]
Optional. The path where YADM will store its bare Git repository. If omitted, YADM defaults to creating the bare repository at ~/.yadm/repo.git. This is the Git repository itself, not your home directory where files are managed.
[ options ]
Any valid options supported by the underlying git clone command. yadm clone passes all recognized options and arguments directly to git clone. Examples include --branch <name> for cloning a specific branch, --depth <num> for a shallow clone, or --recursive for initializing submodules.
DESCRIPTION
The `yadm-clone` command is a fundamental subcommand of YADM (Yet Another Dotfiles Manager), designed to initialize a new YADM environment. It works by cloning an existing Git repository, which typically contains your dotfiles, as a bare repository. Unlike a standard `git clone` that creates a new working directory populated with files, `yadm-clone` sets up a bare Git repository (by default in ~/.yadm/repo.git) and configures Git to manage files directly within your home directory (~) by setting `core.worktree` and `GIT_DIR` appropriately. This command establishes the foundation for YADM to track, manage, and synchronize your configuration files across multiple machines. It's the first step to bringing your dotfiles under YADM's control.
CAVEATS
Git Dependency: yadm-clone relies on Git being installed and accessible in the system's PATH.
Bare Repository: It establishes a bare Git repository, which means the repository itself (e.g., .git directory) is separated from the working tree (your home directory). This is YADM's core mechanism for managing dotfiles.
No Automatic Checkout: After successfully cloning the repository, yadm-clone does not automatically populate your home directory with the dotfiles. You will typically need to run yadm checkout or yadm pull afterwards to synchronize the files from the repository to your working directory.
Overwriting Existing Files: Be cautious when performing initial setup on a system with existing dotfiles, as subsequent yadm checkout or yadm pull operations can overwrite unmanaged files if not handled carefully.
INITIAL SETUP WORKFLOW
The typical workflow after running yadm clone involves a subsequent command to populate your home directory. For instance, after yadm clone git@github.com/user/dotfiles.git, you would usually execute yadm checkout or yadm pull to bring the managed dotfiles from the cloned bare repository into your ~ (home) directory. This two-step process ensures the repository is correctly set up before files are deployed.
BARE REPOSITORY CONCEPT
yadm clone fundamentally sets up a bare Git repository. In Git, a 'bare' repository does not have a working directory; it only contains the Git metadata (objects, refs, etc.). YADM cleverly uses this by setting your home directory as the working tree and the bare repository (e.g., ~/.yadm/repo.git) as the Git directory. This allows Git to track changes and manage files directly in your home directory without needing a separate project folder, which is ideal for dotfiles.
HISTORY
YADM (Yet Another Dotfiles Manager) was created by Mike Goltzman to provide a more streamlined and robust way to manage dotfiles using Git, addressing some complexities of traditional bare Git repository setups. The yadm-clone command is a foundational part of YADM, designed from its inception to simplify the initial setup and adoption of YADM by encapsulating the necessary Git commands and configurations for a bare repository dotfile management system. Its development has focused on ease of use and integrating smoothly with the broader YADM ecosystem.