README.md

December 28, 2023 ยท View on GitHub

Dotbot git Plugin

Plugin for Dotbot, that adds git directive, which allows you to clone or pull git repositories.

Installation

  1. Simply add this repo as a submodule of your dotfiles repository:
git submodule add https://github.com/DrDynamic/dotbot-git.git
  1. Pass this folder (or directly git.py file) path with corresponding flag to your Dotbot script:
  • -p /path/to/file/git.py

or

  • --plugin-dir /pato/to/plugin/folder

Requirements

This plugin needs git 2.22 or later to be installed.

Also please note, that this plugin clones repositories direcly into the given path. No subfolders are created!

Properties

NameDescriptionRequired
urlThe URL to the remote repositoryRequired
branchThe branch to checkout after clone (or pull)optional
commitThe commit to checkout after clone (or pull)optional
methodEither clone, pull or clone-or-pull (see Supported methods)optional
descriptionThe description of the Repository (only for log output)optional
recursiveIf true, git clone and/or git pull will be run with --recurse-submodulesoptional

Supported methods

MethodDescription
cloneJust clone the repository and checkout the configured branch / commit. Ignore that entry if that is alredy done.
pullJust pull the existing directory. Failes if the directory doesn't exist or isnt a git repository
clone-or-pullDEFAULT - Clones the repository if it doesnt exist or pulls changes if it does.

Supported task variants

...
- git: 
    '/local/path/to/clone/to':
       url: <url to repository> 
       branch: <name of the branch>
       commit: <commit hash>
       method: <clone|pull|clone-or-pull> 
       description: <name of the repository or something like that>
       recursive: <true|false>
    ...
...

Usage

Example config

...
- git:
    '~/.oh-my-zsh/custom/plugins/zsh-autosuggestions':
        url: 'https://github.com/zsh-users/zsh-autosuggestions'
        description: 'oh my zsh - autosuggestions'
    '~/.oh-my-zsh/custom/themes/powerlevel10k':
        url: 'https://github.com/romkatv/powerlevel10k.git'
        description: 'oh my zsh - powerlevel10k'
    '~/.zprezto':
        url: 'https://github.com/sorin-ionescu/prezto.git'
        description: "Install zprezto"
        recursive: true
    ...
...

Execution

"~/.dotfiles/bin/dotbot" -d "~/.dotfiles" -c "~/.dotfiles/packages.yaml" -p "~/.dotfiles/plugins/dotbot-git/git.py"