Last active
February 7, 2021 13:12
-
-
Save dberstein/f0c673b9d7275d162bb65fbb60091f54 to your computer and use it in GitHub Desktop.
simple git alias for dotfiles management
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git-dotfiles: simple git alias for dotfiles management | |
# 1. configure dotfiles checkout location ... | |
git config --global --replace-all dotfiles.dir "$HOME/.dotfiles" | |
# 2. init dotfiles ... | |
git init --bare "$(git config --global dotfiles.dir)" | |
# 3. create git dotfiles alias ... | |
git config --global --replace-all alias.dotfiles '!git --git-dir="$(git config --global dotfiles.dir)" --work-tree="$HOME"' | |
# 4. (OPTIONAL) | |
echo \* >> $HOME/.gitignore | |
# Usage: git dotfiles ... | |
# $ git dotfiles add -f $HOME/.bashrc $HOME/.bash_profile ... | |
# $ git dotfiles commit -m '...' ... | |
# $ git dotfiles remote add ... | |
# $ git dotfiles push ... | |
# Alternative dotfiles alias: | |
cat <<EOS | tee "$HOME/.bashrc" | |
alias dotfiles="/usr/bin/git --git-dir='$(git config --global dotfiles.dir)' --work-tree='$HOME'" | |
EOS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment