Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What worked best for me is to turn my user's home dir into a Git repository. My .gitignore contains this:

*

And if I need to add something, I just "git add -f ...". Works surprisingly well. Combines well with git-secret for things like SSH keys, certificates and API keys.



I wouldn't trust that... If you by mistake run `git clean -xfd` in your home, well, you know what happens


Same thing as running `rm -rf *` by mistake. Don't do that and keep backups.


Ha, I'll probably never run that command but perhaps some git commands can be disabled if they're run in ~/



Or git-crypt or SOPS


my dotfiles follow atlassian's tutorial where they do this, but put the git dir somewhere else and alias away the git command. It has worked pretty well for me.

https://www.atlassian.com/git/tutorials/dotfiles


Only downside to this are tools that default to only acting on stuff under version control. Whenever I use rg inside my home directory I'm caught out by this.


I was caught by that too. But a recent read has given me a tip. Add a ripgrep specific ignore files that undo the home gitignore.




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

Search: