Skip to content

Instantly share code, notes, and snippets.

@diffficult
Last active December 2, 2022 01:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diffficult/4dc41b2a31eb7910bf55662b575a67e1 to your computer and use it in GitHub Desktop.
Save diffficult/4dc41b2a31eb7910bf55662b575a67e1 to your computer and use it in GitHub Desktop.
Basic stow guide for idiots

KISS instructions on how stow works and how to easily set it up

Create a git repo directly in your home folder, .g. ~/dotfiles

In this directory, you create a folder with a "package name" and in it the exact folder structure this app has it's config files in your home folder.

Let's take i3 for example, which has its config file in ~/.config/i3/config

Move this file into ~/dotfiles/i3/.config/i3/config. Now you can git add and git commit it, like usual.

In your terminal, cd dotfiles. From there, you can do this:

stow i3

This will enter the folder i3, which we created (as the mentioned "package name") and everything in it will be symlinked exactly one directory above where you currently are.

This means, from ~/dotfiles it jumps one folder up (so it's ~) and there the folder structure inside your "i3" package will be symlinked.

This means your moved config file now is at the same place as before, but symlinks into your git repo. Now you can edit your config as usual and your changes are automatically tracked. Clone on another device, stow i3 and boom! you have the same config there.

If you want to stow your ~/.Xresources, the file would be e.g. at ~/dotfiles/Xresources/.Xresources and you would do a stow Xresources in there.

You can also do your whole configuration into one "package", so you just have to stow once.

Very easy stuff to set up and you only need git and stow for it.

yadm is, a wrapper for this workflow and does some things on top of it. E.g. you can append your hostname at the file name, so yadm checks which file for which hostname it should link.

For example two files for two machines:

~/dotfiles/i3/.config/i3/config##myworkstation
~/dotfiles/i3/.config/i3/config##trollwutslaptop

all credit to most excellent post from /u/Trollw00t explaining how to use stow + git

@MarSoft
Copy link

MarSoft commented Sep 2, 2019

How do you use yadm with stow-based approach? I thought that yadm uses completely different approach, by creating git repo in ~/.yadm/repo.git with its worktree set to $HOME, while stow approach uses (regular) git repo in ~/dotfiles with symlinks...

@diffficult
Copy link
Author

How do you use yadm with stow-based approach?

I'm still using stow and haven't moved on to use yadm, kept this post explaining the process to pass around to a few friends. I believe it just pointed out how easy was to use and to jump unto yadm if you needed the extra features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment