Live data from Hacker News

Unofficial guide to dotfiles on GitHub

dotfiles.github.io

41–50 of 65 posts

Re: Unofficial guide to dotfiles on GitHub

#42
I create my .vimrc and .tmux.conf when I set up my machine or when I get annoyed at the defaults.

I find the problem with "set and forget" kind of jobs is that you forget how to do something because someone else already did it for you, so you don't learn anything. It's similar to joining a complicated project where everything has been set up for you and all problems were solved and if you were to join a new project from day 1 you would have to learn everything again. (See setting up CI/CD, the structure of a java project, a gradle file, a maven POM, Dockerfiles, git, Kubernetes manifests and other devops tasks)

You still need to learn how to do things. I want to be fluent in the tools I use, so I would rather do things from memory.

Re: Unofficial guide to dotfiles on GitHub

#44
post #11
post #4

tl;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…

One potential drawback of doing that is that every directory under ~/ that is not itself part of another git repository becomes part of that git repository, which could make some programs act weird, particularly project auto-detectors in IDEs and such. To avoid that, one can rename the `.git` folder, effectively disabling auto-discovery, and run git with the option `--git-dir= `.

In `~/.git/config` do:

   [status]
     showUntrackedFiles = no
That solves most of those problems, as git will only consider files already in the repository and ignore everything else in your home directory.

Re: Unofficial guide to dotfiles on GitHub

#45
Just wanted to mention Stow[1] here, which I use to symlink my dotfiles on a new machine on a per app basis for many years now. My set up script just installs basic compiler toolchain and runs a bunch of stow commands based on Linux/Mac OS. I also adhere to XDG base spec[2] so I can keep my ~/ clean.

1: https://www.gnu.org/software/stow/ 2: https://wiki.archlinux.org/title/XDG_Base_Directory

Re: Unofficial guide to dotfiles on GitHub

#46
post #41

There are so many utilities. Why not just use ansible? It can manage your dotfiles and much more (you can configure your whole machine).

Ansible is wonderful. I'd strongly consider it if I wasn't against the idea of having interesting enough dotfiles to version.

What I do with RasPi servers is I make a pull and a push playbook that live in a repo, which let me deploy what I have onto a new server, and pull any changes made in server web GUIs into the repo where I can commit them.

Then of course any other random periodic task also becomes an Ansible task.

If I had a use case for lots of random little scripts on my main machine, I think I'd choose Ansible over bash where practical, you get so many tools premade, and you can run local or remote all the same.

Re: Unofficial guide to dotfiles on GitHub

#47
post #45

Just wanted to mention Stow[1] here, which I use to symlink my dotfiles on a new machine on a per app basis for many years now. My set up script just installs basic compiler toolchain and runs a bunch of stow commands based on Linux/Mac OS. I also adhere to XDG base spec[2] so I can keep my ~/ clean. 1: https://www.gnu.org/software/stow/ 2: https://wiki.archlinux.org/title/XDG_Base_Directory

Stow is the answer as far as I'm concerned. It's been around forever, it's standard, available in every package manager, the defaults just work.

I use it in combination with a make to automate the setup of a new install.

Re: Unofficial guide to dotfiles on GitHub

#48
post #39

I have my home directory as a git repo: works great, simple, no symlinking

Interesting. But I guess there must be files that you don't check in because of size?

You can .gitignore everything. I used to have my homedir as git repo, but abadoned that because it interfered with other git repos inside my home. Nowadays i have ~/.config as git root, with some symlinks supporting the programs that don't look there on their own.

Re: Unofficial guide to dotfiles on GitHub

#50
post #45

Just wanted to mention Stow[1] here, which I use to symlink my dotfiles on a new machine on a per app basis for many years now. My set up script just installs basic compiler toolchain and runs a bunch of stow commands based on Linux/Mac OS. I also adhere to XDG base spec[2] so I can keep my ~/ clean. 1: https://www.gnu.org/software/stow/ 2: https://wiki.archlinux.org/title/XDG_Base_Directory

Also, the latest version (>= 2.3.0, released June '19) has a new flag specific to managing dotfiles. When passing `--dotfiles`, stow replaces `dot-` at the beginning of filenames with `.` in the symlinks. The online help does not mention it, but the release notes and man pages do.
Post reply on HN