Hacker News new | ask | show | jobs
by sciencerobot 3713 days ago
I tried this but git uses ~/.git for any subdirectory of $HOME. For example, if you type `git add .` while in ~/code/some-project, you will add it to your dotfiles repository. It's easy to undo but still kind of annoying.
2 comments

> For example, if you type `git add .` while in ~/code/some-project, you will add it to your dotfiles repository.

If your project has its own .git directory, no, it won't add to ~/.git.

You're right. I forgot to mention that this only happens if you haven't initiated a new git repository in the directory you're working in.
You can add

export GIT_CEILING_DIRECTORIES=~

to your .bashrc (or equivalent)