Unofficial guide to dotfiles on GitHub
dotfiles.github.io
Unofficial guide to dotfiles on GitHub
1–10 of 65 posts
Re: Unofficial guide to dotfiles on GitHub
#2Re: Unofficial guide to dotfiles on GitHub
#3[This] way (linked from the tutorials section of the page) is a great way to version your dotfiles without symlinks or installer scripts. [This]: https://www.atlassian.com/git/tutorials/dotfiles
Re: Unofficial guide to dotfiles on GitHub
#4Re: Unofficial guide to dotfiles on GitHub
#5[This] way (linked from the tutorials section of the page) is a great way to version your dotfiles without symlinks or installer scripts. [This]: https://www.atlassian.com/git/tutorials/dotfiles
Re: Unofficial guide to dotfiles on GitHub
#6[This] way (linked from the tutorials section of the page) is a great way to version your dotfiles without symlinks or installer scripts. [This]: https://www.atlassian.com/git/tutorials/dotfiles
I use this script (which I modified a bit from the Atlassian one) to bootstrap it on a new $HOME dir (replace "***YOUR_GIT_REPO_ADDRESS***" with your address; also, you need to copy the function ,cfg into your .*rc file for command-line use):
#!/bin/bash
set -euo pipefail # the usual stuff
# TODO: copy the below function into your .*rc file
function ,cfg {
/usr/bin/git --git-dir="$HOME/.cfg/" --work-tree="$HOME" "$@"
}
# TODO: replace '***YOUR_GIT_REPO_ADDRESS***' below
git clone --bare git@***YOUR_GIT_REPO_ADDRESS***/.cfg "$HOME/.cfg"
,cfg config status.showUntrackedFiles no
if ,cfg checkout; then
# worked fine, we're done
echo "Checked out config."
else
# it failed, so assume we need to move some files out of the way
echo "Backing up pre-existing dot files."
mkdir -p "$HOME/.config-backup"
,cfg checkout 2>&1 | grep -e "\s+\." | awk "{'print $1'}" | xargs -I{} mv {} "$HOME/.config-backup"/{}
,cfg checkout || (echo "Still cannot checkout configs; see messages and fix." && exit 1)
echo "Checked out config."
fi
I also have a git alias to commit files that are tracked with a message: ctm = commit -a -u -m #commit all tracked files with message
So you can do like this to commit changes and push them: ,cfg ctm "I modified my .zshrc"
,cfg push*Re: Unofficial guide to dotfiles on GitHub
#7Re: Unofficial guide to dotfiles on GitHub
#8Their Vim-specific recommendations are woefully out of date.
Re: Unofficial guide to dotfiles on GitHub
#9tl;dr: Create a .gitignore in your ~ with an asterisk on the first line and `!.dotfilename` on subsequent lines; the asterisk means Git will ignore everything, and the ! means Git will un-ignore that specific file or directory. (Be sure to include the .gitignore file itself.) Use Git as normal and push. To deploy on another machine/account, the easiest method is to check out as normal into a temporary directory, then…
Re: Unofficial guide to dotfiles on GitHub
#10https://docs.github.com/en/codespaces/customizing-your-codes...