Hacker News .hnnew | past | comments | ask | show | jobs | submitlogin

I am sure there is a better way but I just do this. It works well enough for my purposes.

cd ~

git init

git remote add origin [URL]

git fetch

git checkout -f master



Recommend you also add "*" to your $HOME/.gitignore in this setup. Then you simply need to use `git add -f` to force-add files to your dotfiles store, so that you don't accidentally add files you don't intend to keep there.


I also do this. I would highly recommend doing it otherwise you may accidentally commit your ssh keys or other secrets.


Can confirm this works extremely well. Here's how I do it:

    git clone --bare <dotifles repo> ~/.dotfiles
    git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME checkout
    git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME config --local status.showUntrackedFiles no
And then I add an alias:

    alias cfg='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
Now I can just manage my dotfiles as a git repo, and I don't have to worry about accidentally adding local secrets to the repo.


Yeah, that's what I do. And I have an ever-growing .gitignore file with all the dot files and things I don't care about like ~/Downloads...


If you put * in the gitignore file you don't have to deal with ignoring the downloads directory. When you want to add a new file / directory just add the -f flag (git add -f) and everything else works as normal.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: