Skip to content

Instantly share code, notes, and snippets.

@yosevu
Last active August 20, 2023 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yosevu/eaf39c6dd6c9c0712b0254c836130aa7 to your computer and use it in GitHub Desktop.
Save yosevu/eaf39c6dd6c9c0712b0254c836130aa7 to your computer and use it in GitHub Desktop.
Dotfile Git Setup

Setup

  1. git init --bare $HOME/.dotfiles
  1. alias dot='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
  • Create an alias for git e.g. dot to configure the .dotfiles repository.
  1. dotfiles config --local status.showUntrackedFiles no
  • Configure Git to not show local files that are not being tracked when using commands like git status.
  1. echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'" >> $HOME/.bashrc (Optional)
  • Add git alias to ~/.bashrc.

Clone

  1. git clone --bare <git-repository-url> $HOME/.dotfiles
  2. alias dot='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
  3. dot checkout
  4. dot config --local status.showUntrackedFiles no

Update

  1. dot status
  2. dot add .vimrc or dot add ./config/nvim/init.vim
  3. dot add .bashrc
  4. dot commit -m "Add dotfiles"
  5. dot push

Source: https://news.ycombinator.com/item?id=11070797

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment