TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Way to Manage Dotfiles

68 pointsby bminuslabout 4 years ago

18 comments

podikiabout 4 years ago
Personally, I use git [0] along with GNU stow [1], combined with making the files directly from a literate Readme.org (e.g. [2]). I sync this repository between machines to update files, and when I make changes in the org-mode Readme file it automatically generates the new file. There are ways to pull in changes made to that file directly, but haven&#x27;t needed to do that. My repo doesn&#x27;t walk you through it completely, but I think is pretty straightforward. If you want to see it in action along with a few links and pointers, do take a look at [0]. I really like having it all together in one place, and with org-mode everything is very (human) readable.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;podiki&#x2F;dot.me" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;podiki&#x2F;dot.me</a><p>[1] <a href="https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;stow&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;stow&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;podiki&#x2F;dot.me&#x2F;blob&#x2F;master&#x2F;x11&#x2F;README.org" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;podiki&#x2F;dot.me&#x2F;blob&#x2F;master&#x2F;x11&#x2F;README.org</a>
评论 #27135905 未加载
评论 #27136335 未加载
tdfirthabout 4 years ago
I&#x27;ve been using this bare repository approach for a while. I forget where I first saw it, I&#x27;m pretty sure it was on HN but it was not this project. I do like it, but I have a few minor issues.<p>The first is that I have a habit of running `git add .` when I&#x27;m working on source code, and as a result I have accidentally added my entire home directory to the bare repo more than once... Easy enough to undo but a bit inconvenient. `dotfiles add -u` is the safe option, or just be explicit about which files you are staging.<p>The second issue is the &#x27;branch per machine&#x27; approach, which I do use. I have two machines I use regularly, and a third occasionally. There are some bits of config (e.g. for vim) that are shared across all the machines, while other bits are not. If I use one machine for a while, then I end up with lots commits that I need to cherry pick when I next use another machine. Depending on how long it has been, this can be a bit of a faff.<p>Finally, because there is no clear mainline branch, you have to pick commits to&#x2F;from any of the branches. If you are undisciplined like me, then this will leave you with a &#x27;three way ahead and behind&#x27; scenario at some point.<p>Anyway, I like the approach overall. If anyone has a suggestion to ease those pain points I&#x27;m all ears.
评论 #27135294 未加载
评论 #27138731 未加载
评论 #27136510 未加载
评论 #27135461 未加载
andsensabout 4 years ago
Just throwing my solution for dotfiles synchronization into the mix as well here, homeshick: <a href="https:&#x2F;&#x2F;github.com&#x2F;andsens&#x2F;homeshick" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;andsens&#x2F;homeshick</a><p>Maintained for 8 years now, 1.7k stars, only needs git &gt;=1.5, bash &gt;=3, and no root access to install.<p>It&#x27;s well tested, stable, and super hackable to fit your needs.
评论 #27136733 未加载
cbarrickabout 4 years ago
I just maintain an install script to do the linking. It&#x27;s just a few lines of zsh to mirror one directory into another with symlinks.<p>I&#x27;ve found that the bare repo approach has too many rough edges, and that the various dotfile management frameworks are overkill.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;cbarrick&#x2F;dotfiles&#x2F;blob&#x2F;master&#x2F;home&#x2F;install.zsh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cbarrick&#x2F;dotfiles&#x2F;blob&#x2F;master&#x2F;home&#x2F;instal...</a>
评论 #27138634 未加载
tpoacherabout 4 years ago
Often enough, when I see something like this, the real value isn&#x27;t the software itself, but the idea that perhaps the issue it addresses is worth thinking about a bit more. The solution itself may be trivial, but have a large impact.<p>E.g. I have created [0] the simplest of scripts for managing updates for manually-installed &#x2F; source-compiled applications (something I&#x27;ve dubbed &quot;misc&quot;, very proud of this backronym :p).<p>The script itself is extremely simple (just a list of greps over latest release announcement urls), but it has solved a big problem for me, of helping me keep such &quot;misc&quot; items seamlessly up-to-date.<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;tpapastylianou&#x2F;misc-updater" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tpapastylianou&#x2F;misc-updater</a>
swalladgeabout 4 years ago
Any love for rcm [1]? I settled on this after trying many dotfiles systems - works for me with just the right feature set. I don&#x27;t often see it mentioned on dotfiles discussions online though.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;thoughtbot&#x2F;rcm" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;thoughtbot&#x2F;rcm</a>
评论 #27136658 未加载
评论 #27136720 未加载
DiabloD3about 4 years ago
I do a similar thing, but with dotbot instead <a href="https:&#x2F;&#x2F;github.com&#x2F;anishathalye&#x2F;dotbot" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;anishathalye&#x2F;dotbot</a>
twpabout 4 years ago
Bare git repos are fine for starting, but you quickly hit limits if you want to use your dotfiles on different machines, e.g. share your .zshrc config between Linux and macOS.<p>A comparison of popular dotfile managers:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;twpayne&#x2F;chezmoi&#x2F;blob&#x2F;master&#x2F;docs&#x2F;COMPARISON.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;twpayne&#x2F;chezmoi&#x2F;blob&#x2F;master&#x2F;docs&#x2F;COMPARIS...</a>
sneakabout 4 years ago
I sync a directory of dotfiles across my workstations using syncthing. The .bashrc and .profile simply do:<p><pre><code> for FN in ~&#x2F;.paths&#x2F;sneak-sync&#x2F;bashrc.d&#x2F;*.sh ; do source $FN done </code></pre> Then updates (by adding or removing files to these directories) propagate to all my workstations. I have machine-specific ones, too, that also sync but aren&#x27;t included due to differing hostnames.
评论 #27135513 未加载
评论 #27135397 未加载
CGamesPlayabout 4 years ago
I never liked the git bare repository approach, because it&#x27;s each to accidentally add files to it that you don&#x27;t intend (if you forget to run git init in a new project directory; or if some code generator decides to &quot;re-use&quot; your existing git repository). I prefer the symlinks approach, but I never liked how all of the symlinks managers tend to leave broken symlinks all over the place.<p>That&#x27;s why I created my own solution, which maintains a state file in the repo, so doing something like deleting a config file or switching a git branch doesn&#x27;t result in a bunch of broken symlinks lying in your system.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;cgamesplay&#x2F;dfm" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cgamesplay&#x2F;dfm</a>
uneeknameabout 4 years ago
I like the bare repository approach here. I&#x27;ve been using symbolic links to version control my dotfiles with git.
评论 #27134754 未加载
评论 #27135121 未加载
gary_bernhardtabout 4 years ago
I&#x27;ve had my dotfiles under version control for over a decade (hg for a couple years, then git). I&#x27;ve never used or felt the need for any special tools, and I don&#x27;t use any extra symlinking.<p>If you do that stuff, great, but here&#x27;s what I do if you don&#x27;t want to use any specialized tools:<p>My home directory is just a git repo. There&#x27;s a regular old ~&#x2F;.git directory. All of the management I do is regular git stuff, like any other repo. Everything I don&#x27;t want to commit is listed in .gitignore, like any repo.<p>The only wrinkle is setting up a new machine. You can&#x27;t clone into an existing directory (AFAIK), and your home directory already exists, so you need a workaround. An easy solution: clone the remote repo to ~&#x2F;dotfiles, then `mv ~&#x2F;dotfiles&#x2F;.git ~`, then `rm -r ~&#x2F;dotfiles`. Now your home directory is a git repo where the working copy is exactly as the home directory was before, and HEAD points to your repo&#x27;s default branch. It will be dirty because all of your config files are missing. Use regular `git status` to take a look. It&#x27;s always looked fine to me, so I `git checkout .`, which effectively installs the dotfiles. Then I&#x27;m done until I need to do that copy trick again when I buy my next computer. In the meantime I just commit and push as normal, and occasionally add a new file to .gitignore.
评论 #27138716 未加载
andypeaabout 4 years ago
I&#x27;ve found that a simple dot_files directory that is sync&#x27;d via a public git repository [0] works well for me. When I&#x27;m on a new machine all I need to do is clone the repository and run `ln -s ~&#x2F;dot_files&#x2F;bash&#x2F;bashrc ~&#x2F;.bashrc`. The bashrc file then takes care of everything else.<p>It might not work for every program out there, but it does for the small number that I use.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;andypea&#x2F;dot_files" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;andypea&#x2F;dot_files</a>
barrkelabout 4 years ago
How do people manage the platform differences between Linux, macOS, Windows WSL, Windows Cygwin, Solaris (at one point I had it on my NAS); and environment differences, such as work machines vs home machines?<p>I have my own dotfiles mechanism which splits out paths and configs by operating system, portable runtimes (e.g. Mono - may work on different OSes) and environments (enabling home and work configs to be stored in a separate repo and avoiding data leakage). Things like .bashrc and .bash_profile are assembled piecewise from fragments in each component.<p>Modifications to generated files by installers (notoriously, things like rvm, nvm etc. all want their stuff to be last in the config file, first in the path and all that) are detected so they can be integrated and not accidentally overwritten.<p>It&#x27;s somewhat complex - I&#x27;m deliberately not linking it because I wouldn&#x27;t recommend other people use mine, I have no time to support it - but to my mind these features are critical for any dotfile management system.
评论 #27142183 未加载
josephscottabout 4 years ago
I&#x27;ve been happy with <a href="https:&#x2F;&#x2F;yadm.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;yadm.io&#x2F;</a> to manage dotfiles.
kbdabout 4 years ago
Since we&#x27;re sharing, my dotfiles setup has pretty much reached its final form. I use my symgr[1] to symlink my dotfiles repo into my home dir. Pretty much everything I think about this topic is in its readme, as well as a link to my setup[2] repo with my dotfiles showing how I use symgr.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;kbd&#x2F;symgr" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kbd&#x2F;symgr</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;kbd&#x2F;setup" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kbd&#x2F;setup</a>
blissofbeingabout 4 years ago
I would highly recommend zero-sh[1] for those looking for a consistent simple tool to manage dotfiles on a mac.<p>1. <a href="https:&#x2F;&#x2F;github.com&#x2F;zero-sh&#x2F;zero.sh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zero-sh&#x2F;zero.sh</a>
bestcoder69about 4 years ago
My solution is to just nuke them every time I get a new comp. I never really miss my old setup that much.