Re:Ask HN: What do you use to manage dotfiles?
by seliopou on Wednesday February 10, 2016 @06:23AM
(#11071976)
To complete the description of the workflow (for others), you can replicate your home directory on a new machine using the following command:
git clone --separate-git-dir=~/.myconf /path/to/repo ~
This is the best solution I've seen so far, and I may adopt it next time I get the itch to reconfigure my environment.
Re:Ask HN: What do you use to manage dotfiles?
by telotortium on Thursday February 11, 2016 @04:26AM
(#11079145)
For posterity, note that this will fail if your home directory isn't empty. To get around that, clone the repo's working directory into a temporary directory first and then delete that directory,
git clone --separate-git-dir=$HOME/.myconf /path/to/repo $HOME/myconf-tmp
cp ~/myconf-tmp/.gitmodules ~ # If you use Git submodules
rm -r ~/myconf-tmp/
alias config='/usr/bin/git --git-dir=$HOME/.myconf/ --work-tree=$HOME'
and then proceed as before.
Re:Ask HN: What do you use to manage dotfiles?
by durdn on Wednesday February 17, 2016 @07:18AM
(#11117304)
I found out exactly the same problem :)
Re:Ask HN: What do you use to manage dotfiles?
by durdn on Wednesday February 17, 2016 @07:09AM
(#11117262)
As promised I wrote a post about your setup. Thanks a lot for bringing the technique to my attention: https://developer.atlassian.com/blog/2016/02/best-way-to-sto...
Re:Ask HN: What do you use to manage dotfiles?
by StreakyCobra on Monday February 22, 2016 @03:45AM
(#11149444)
Really nice, well explained. I'll know where to point people to when I need to present this techique. Thanks!
Re:Ask HN: What do you use to manage dotfiles?
by aprdm on Wednesday February 10, 2016 @06:41AM
(#11072061)
Can you write a blog post on your workflow? I would love to learn more on how you to use it :P
Re:Ask HN: What do you use to manage dotfiles?
by StreakyCobra on Wednesday February 10, 2016 @08:58AM
(#11072710)
There are probably already posts about this: I didn't invented it, I read it somewhere… but it was long time ago, I don't remember where.
Re:Ask HN: What do you use to manage dotfiles?
by durdn on Wednesday February 10, 2016 @08:47AM
(#11072644)
I'm trying to reproduce it and documenting it as I go... ok I got it working now and I have notes. Stay tuned.
Re:Ask HN: What do you use to manage dotfiles?
by StreakyCobra on Wednesday February 10, 2016 @09:00AM
(#11072722)
It's probably better if you do it then :-) I would probably skip some important parts trying to explain because I'm too much used to it already.
Re:Ask HN: What do you use to manage dotfiles?
by Siilwyn on Saturday February 13, 2016 @03:16PM
(#11095494)
Finally got mine working, it does need some figuring out especially the replication part. I documented the needed commands here: https://github.com/Siilwyn/my-dotfiles/tree/master/.my-dotfi...
Re:Ask HN: What do you use to manage dotfiles?
by durdn on Wednesday February 17, 2016 @07:11AM
(#11117271)
I'll check how you did it. I wrote my notes and a couple of scripts down in a post: https://developer.atlassian.com/blog/2016/02/best-way-to-sto...
Re:Ask HN: What do you use to manage dotfiles?
by durdn on Wednesday February 10, 2016 @09:14AM
(#11072802)
Working on it! I'll give you full credit for it and link to this thread for reference. Also let me know if you have a Twitter account you'd like me to reference.
Re:Ask HN: What do you use to manage dotfiles?
by StreakyCobra on Wednesday February 10, 2016 @09:41AM
(#11073003)
Nice thanks. I don't have twitter. Also don't present me as the inventor of this technique because I'm not. I've read this long time ago on some dark corners of the internet :-) I'm just pointing it out.
Re:Ask HN: What do you use to manage dotfiles?
by durdn on Wednesday February 10, 2016 @09:51AM
(#11073071)
Alright I'll be careful in my wording ;).
Re:Ask HN: What do you use to manage dotfiles?
by wooptoo on Wednesday February 10, 2016 @07:12AM
(#11072200)
Why is this a bare repo as opposed to a normal one?
Re:Ask HN: What do you use to manage dotfiles?
by StreakyCobra on Wednesday February 10, 2016 @08:53AM
(#11072675)
Because the working tree is already your home folder, you don't need to also have a copy of these files in ".myconf/".
Re:Ask HN: What do you use to manage dotfiles?
by idle_zealot on Wednesday February 10, 2016 @09:56PM
(#11077955)
So why use .myconf/ at all? What is it doing?
Re:Ask HN: What do you use to manage dotfiles?
by telotortium on Thursday February 11, 2016 @04:20AM
(#11079125)
It contains the files that would normally be in .git (run `git help gitrepository-layout` for more details on the contents).
Re:Ask HN: What do you use to manage dotfiles?
by durdn on Wednesday February 10, 2016 @06:17AM
(#11071950)
Honestly this is genius! I hadn't thought of doing it like that, thank you! I had resorted to the usual .cfg folder and a helper script to link/update everything.
Re:Ask HN: What do you use to manage dotfiles?
by shabda on Wednesday February 10, 2016 @06:44AM
(#11072074)
Could you explain how this works? Won't this be putting the .bashrc in $HOME/.myconf/.bashrc, which won't get picked up by bash? (And similar for other dotfiles)
Re:Ask HN: What do you use to manage dotfiles?
by unwind on Wednesday February 10, 2016 @06:54AM
(#11072132)
No, since the config alias runs git with the option "--work-tree=$HOME", which tells it that the working directory is your home directory root, i.e. where config files (used to) live.
Anyway it's the proper root for config files, since if you use a .config directory (as seems to be the modern choice) that needs to live in your home directory of course.
Re:Ask HN: What do you use to manage dotfiles?
by nindalf on Wednesday February 10, 2016 @06:50AM
(#11072104)
You could add a symlink in your $HOME folder
Re:Ask HN: What do you use to manage dotfiles?
by qznc on Wednesday February 10, 2016 @06:58AM
(#11072150)
"branches for different computers" sounds tedious if most changes are for every computer.
Re:Ask HN: What do you use to manage dotfiles?
by StreakyCobra on Wednesday February 10, 2016 @08:51AM
(#11072668)
I have a "master" branch, and some "computer" branches. When changes are required for all computer, I do it in "master", and then update each branch by doing a "git merge master".
Re:Ask HN: What do you use to manage dotfiles?
by kavehmz on Wednesday February 10, 2016 @09:19AM
(#11072824)
You mean, you are also adding pushing your .ssh dir to a remote repo?
Re:Ask HN: What do you use to manage dotfiles?
by durdn on Wednesday February 10, 2016 @09:22AM
(#11072849)
Not at all. You can 'git add' (or in the case of the technique above 'config add') only the files and folders that are safely stored in a repository. Because of the 'ShowUntrackedFiles' flag, git/config won't always show folders you don't want to track, which would be annoying.
Re:Ask HN: What do you use to manage dotfiles?
by kavehmz on Wednesday February 10, 2016 @09:24AM
(#11072865)
Perfect then,
Re:Ask HN: What do you use to manage dotfiles?
by abricot on Wednesday February 10, 2016 @06:52AM
(#11072112)
I'm confused - you can add files that are in a parent directory?
Re:Ask HN: What do you use to manage dotfiles?
by StreakyCobra on Wednesday February 10, 2016 @08:54AM
(#11072684)
It's because we specify to git that the working tree is the home folder. For it the versionning doesn't happen in ".myconf", but directly in the home folder
No extra tooling, no symlinks, files are tracked on a version control system, you can use different branches for different computers, you can replicate you configuration easily on new installation.