text/gemini
# How i alias git to manage my home directory (for dotfiles)
I am writing this on the first Saturday of September 2022 but the solution described is in use since exactly two years ago already.
I have a repository, hosted on GitHub, it's public and it's mkf/homedirconfig.
They way I set it up:
* i clone my previous homedirconfig repository in a regular way, in some directory where i would store code repositories
* i paste my alias into the rc of my shell of choice, in this case tcsh, so .tcshrc:
```tcsh
alias gd env GIT_WORK_TREE="$HOME" \
GIT_DIR="$HOME/.gd" \
GIT_CONFIG="$HOME/.gdconfig" \
git -c "core.excludesfile=$HOME/.gdignore"
```
* i create a newly-named branch with gd, after initing the repo
* i copy things from other machines' branches for first versions
* i cherry-pick any further (or initializing) changes
I also used to achieve identity between branches and then have the branches have some common root, but not doing that anymore.
#### Benefits
* i use gd as i would use git, but it acts on my home directory.
* when im not in a git repository, nothing acts on my home directory repository because its files are under different names
* i don't have a collision between .gitconfig of the home repo and the ~/.gitconfig global, which is important
* i don't have the homedir-repo ~/.gitignore potentially act globally
the .git directory is instead named .gd
the repository's .gitconfig is instead stored as .gdconfig
instead of .gitignore i have .gdignore (funny TIL Godot the game engine has its ignore file named the same haha)
### Previously
I used to instead try staging the file .gd/info/exclude (counterpartly, .git/info/exclude)
=> https://github.com/mkf/homedirconfig/commit/7a6f15ebeeda04a3258dc70ab2f5e2e9d72f2854
That wasn't too neat to manage.
It's benefit: it could both be managed by git in a non-aliased repo, as well as being immediately present there and not needing a core.excludesfile setting.
=> https://wiki1.mikf.pl/git/excludefiles.html
### Post scriptum
Whoosh, I just reminded myself of my old blog, and there is a mention of this repo from January 2020. So that's over 2.5y ago.
"Today I asked on Super User: Are .gitignore files from directories above the repository's or from home directory loaded in any versions of Git?" (250 words)
=> https://log1.mikf.pl/today_i_asked_superuser_gitignore/
I guess I just didn't host it on Github back then, but on a regular ssh *nix.
## This post was prompted by
reading @aelspire's
=> gemini://aelspire.info/posts/2022-07-28-dotfiles/post.gmi 2022-07-28 – The slacker’s guide to managing dotfiles
This content has been proxied by September (3851b).