3 ms·
[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.a
by jbaber 4y ago
[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 https://www.atlassian.com/git/tutorials/dotfiles
- Jalad 4y agoWhich was inspired by this HN thread https://news.ycombinator.com/item?id=11070797 https://news.ycombinator.com/item?id=11070797
- MereInterest 4y agoWhat issue do symlinks have that makes them worth listing as a negative? Asking as someone who wrote an installer script to make symlinks a decade ago, and has used it whenever setting up a new computer ever since.
- sokoloff 4y agoI use them and have no issues, but some editors don’t respect symlinks when making backups when you’ve opened the symlink (Rename existing file, make new file with the old name, and now the symlink is renamed and subsequent updates are unlinked as well). I seem to recall I had to set an emacs var to avoid this behavior.
- _-david-_ 4y agoFlatpaks can be an issue depending on the sandboxing. The application may be restricted from accessing the target. Using a hardlinks works, so it isn't that big of an issue to have a couple hardlinks, but it is still something to keep in mind.
- CrystalCuckoo 4y agoEnabling/disabling systemd services is done via managing symlinks. Unfortunately, when disabling a service in systemd, it follows and remove symlinks which can remove your symlinked service files.
- ok_dad 4y agoI use this method, it's great. WAY superior to and WAY easier than using symlinks and having to constantly copy/move and symlink things to a git repo. 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*
- hk1337 4y agoI love the atlassian method for dotfiles. I have been using for a few years now and currently stored on my private gitea server. I also create a branch for each variation, linux, macOS, macOS arm, windows. Basically they’re the same but they all have slightly different things I cannot use universally.
- jmprspret 4y agoFWIW, that isn't the "atlassian method" for dotfiles. People have been doing bare repos for a while. Also, pretty sure they even say at the start of the post they got the original alias from a HN commenter.
- ranaexmachina 4y agoI had different branches for different machines too in the past but it felt very inefficient to me. The configuration was the same for 99% and for the last 1% I had to manually copy stuff back and forth. At the moment, I just try to use tools that allow me to have different configurations for different hostnames or OSs but maybe I should look into one of the fancier dotfile managers…