Skip to main content

Manage and edit $HOME dotfiles using Python + git = <3

Project description

mydot -- A Python module for managing dotfiles

Super-charged version of the Atlassian approach to managing dotfiles using a bare git repo + fzf magic! Quickly edit files, add changes, run scripts, grep through dotfiles, or discard work-tree changes with ease.

Quick Start

  1. Install dependencies:

    sudo apt install fzf git    # Ubuntu/Debian
    brew install fzf git        # MacOS/Homebrew
    
  2. Configure shell: At the bottom of your ~/.bashrc or ~/.zshrc add:

    export DOTFILES="$HOME/.config/dotfiles"
    alias config='/usr/bin/git --git-dir=$DOTFILES --work-tree=$HOME'
    

    what and why?:

    • DOTFILES: variable pointing to your local --bare dotfiles repository
    • config: git alias to directly address the --bare dotfiles repository
  3. Initialize dotfiles repository:

    # reload shell configu
    source ~/.bashrc            # if using bash
    source ~/.zshrc             # if using zsh
    
    mkdir -pv $DOTFILES         # create directory
    git init --bare $DOTFILES   # initialize --bare git repository
    
  4. Install mydot and disable viewing of untracked files

    pip install --user mydot    # if using pip
    pipx install mydot          # if using pipx
    mydot git config --local status.showUntrackedFiles no
    
  5. Add files to your dotfiles repo

    mydot git add ~/.vimrc ~/.tmux.conf ~/.bashrc ~/.bash_aliases ~/.zshrc
    mydot git commit -m "the journey of a thousand miles begins with one step"
    

    protip: You can use all your regular git commands, including aliases, when calling mydot git

  6. Feel the power with mydot (and the pre-installed alias d.)

    d. edit         # modify tracked files in your $EDITOR (tab in fzf for multiselect)
    d. add          # choose which modified files to stage for commit
    d. git commit   # commit changes
    
    d. grep zfs     # find all files with lines containing the string zfs
    d. grep zfs$    # works with regex too! e.g, zfs$ something.*var ^$
    d. grep -E "zfs|ext4" # extended regexp
    
    d. run          # run any executable script in your dotfiles repo
    d. status       # see the state of your repo
    d. ls           # list all files under version control
    
    d. export       # make a tarball of your dotfiles + bare git repo
    d. clip         # put file paths into the clipboard
    
    d. restore      # remove files from staging area
    d. discard      # discard unstaged changes from work tree
    
    d. fzf          # select files and print paths to stdout (for piping)
    d. history      # browse and compare file history
    
    d.              # see the help message detailing available commands
    

Submodule Support

If your dotfiles repo contains git submodules (e.g., ~/.config/tmux), mydot will include their tracked files in edit, fzf, clip, grep, ls, and export (up to 2 levels deep).

Known limitation: d. history will list submodule files but cannot show their per-file commit history. The outer repo only tracks the submodule pointer, not individual file changes within the submodule.

Going Deeper

Useful aliases

alias es="mydot edit"     # quick select a file to edit
alias rs="mydot run"      # quick select a script to run

Source of Truth

This project is available on GitHub and GitLab. Each push to master automatically goes to both so choose whichever platform you prefer. All releases are published to PyPi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mydot-0.10.0.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mydot-0.10.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file mydot-0.10.0.tar.gz.

File metadata

  • Download URL: mydot-0.10.0.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for mydot-0.10.0.tar.gz
Algorithm Hash digest
SHA256 3acfa9f201c42ba4757596e4ad9affed26919dab4ae8def7cb910e630c8cfa06
MD5 5632f772f7a4a4638e84a208c6853aeb
BLAKE2b-256 2ef082283f360d573d83008ebcd40533f43b0de3c9ef351eecb475081d43ed6f

See more details on using hashes here.

File details

Details for the file mydot-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: mydot-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for mydot-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af5c2dee3ccced858ed369eb29657e364bb19fc1ecc4fe1fd239d8f28232ee2a
MD5 2f5a20ba834ed196319c188ceca4587e
BLAKE2b-256 120f63e4e451c1d90802b3b98806b2a14d67b62fdba9d557ec4d9552c1d628bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page