LinuxCommandLibrary

yadm-init

Initialize yadm repository and track existing dotfiles

TLDR

Execute

$ yadm init
copy

Override the worktree
$ yadm init -w [path/to/worktree_folder]
copy

Overwrite an existing repository
$ yadm init -f [path/to/local_repository]
copy

SYNOPSIS

yadm init [options] [directory]

PARAMETERS

-b, --bare
    Initializes the yadm repository as a bare repository. This implies using the 'git' and 'yadm' templates, suitable for direct cloning to a new machine.

-t <name>, --template <name>
    Applies a specified template during initialization. Templates can configure Git settings, add hooks, or include common yadm files. This option can be used multiple times.

--no-template
    Prevents any default or specified templates from being applied during initialization. The repository will be created with minimal default configuration.

--git-config-template <name>
    Applies a specific Git configuration template. This is useful for pre-configuring Git settings within the yadm repository (e.g., user name, email).

--git-options <options>
    Passes additional options directly to the underlying 'git init' command that yadm invokes. This allows for fine-grained control over the Git repository creation.

[directory]
    Specifies the directory where the yadm repository should be initialized. If omitted, the current working directory is used.

DESCRIPTION

yadm-init is the foundational command for setting up your dotfile management with yadm (Yet Another Dotfiles Manager). When executed, it transforms the current directory, or a specified directory, into a dedicated yadm repository.

At its core, yadm-init creates a hidden .yadm directory, which is itself a Git repository. This allows yadm to leverage Git's powerful version control capabilities to track, manage, and synchronize your configuration files (dotfiles) across multiple machines. Unlike traditional Git repositories that manage code within the project directory, yadm uses a bare Git repository approach behind the scenes to manage files in your home directory or any other specified location, making it ideal for dotfiles.

The initialization process can be customized using various options, such as applying templates for common Git configurations or yadm-specific settings, or specifying a directory where the repository should be created. After initialization, you would typically use yadm add to start tracking your dotfiles, followed by yadm commit to save their state, and yadm remote add to link your local repository to a remote version control service like GitHub.

CAVEATS

yadm init creates the .yadm directory, which is a Git repository, but it does not automatically add or track any of your existing dotfiles. You must explicitly use yadm add for each file or directory you wish to manage.

While yadm uses Git, directly manipulating the .yadm directory with standard Git commands is generally discouraged; always prefer using the yadm wrapper commands for consistency and to avoid unexpected behavior. Be mindful when using templates, as they can alter the initial state and behavior of your repository.

THE .YADM DIRECTORY

When yadm init is run, it creates a hidden .yadm directory (or a specified directory) which acts as a bare Git repository. This directory stores all the version control information for your dotfiles, including commit history, branches, remotes, and configurations specific to yadm.

TEMPLATES

yadm templates are pre-defined sets of files or configurations that can be applied during initialization. They are useful for setting up common Git configurations, Git hooks, or initial directory structures within your yadm repository. Custom templates can also be created for specific workflows.

HISTORY

yadm (Yet Another Dotfiles Manager) was created by Kyle Spearin (TheLocehili) as a robust and flexible solution for managing dotfiles using Git, addressing some limitations and complexities of other dotfile management approaches. The yadm-init command is fundamental to yadm's design, being the very first step in setting up a dotfile repository. It has been a core part of yadm since its early development, evolving with features like templating and advanced configuration options to cater to diverse user needs and scenarios for managing sensitive and configuration files.

SEE ALSO

yadm(1), yadm-add(1), yadm-clone(1), yadm-config(1), git-init(1)

Copied to clipboard