4 ms·
alias config="/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME -c status.showUntrackedFiles=no -c submodule.recurse=true -c alias.update="'"!bash '"$HO
by Morphion 5y ago
alias config="/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME -c status.showUntrackedFiles=no -c submodule.recurse=true -c alias.update="'"!bash '"$HOME"'/.config/dotfiles/update_dotfiles.sh"'
- Arnavion 5y agoYou misunderstand. I'm talking about intending to run `git clean -xffd` under `~/src/some-project` (a git repo for some code) but accidentally running it under some other directory, such that it ends up running against `~` Making aliases for working with `~`'s repo doesn't prevent that.
- larschdk 5y agoYes it does. I do the same, with an alias and have .git somewhere else not directly in $HOME, but pointing to it with --git-dir. If you run git in ~, it will not recognize it as a git repository or worktree. You can only modify the repo with the alias or by specifying --git-dir explicitly. These setup also prevents zsh/bash git prompt extensions from detecting git the the home folder repo, which can be confusing, I think.
- Arnavion 5y agoOh, I missed the `--git-dir` part. My bad.
- deleted 5y ago[deleted]