4 ms·
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
by _-david-_ 6y ago
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
- jniedrauer 6y agoCan 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.
- pixelmonkey 6y agoRecommend 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.
- _-david-_ 6y agoI also do this. I would highly recommend doing it otherwise you may accidentally commit your ssh keys or other secrets.
- wheresmycraisin 6y agoYeah, 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...
- _-david-_ 6y agoIf 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.