Hacker News new | ask | show | jobs
by vesinisa 3184 days ago
You are right, I checked and the resulting sub-process tree is the same regardless of whether !git or !exec git is used.

Also, I found one caveat from the same docs:

> Note that shell commands will be executed from the top-level directory of a repository, which may not necessarily be the current directory. GIT_PREFIX is set as returned by running git rev-parse --show-prefix from the original current directory.

So, if I have a modified file `bar` in subdirectory `foo` under project root, and I am currently in `foo`, git status will show:

    modified:   bar
but git git status will show:

    modified:   foo/bar
To fix this, we should use cd first:

    git config --global alias.git '!cd "$GIT_PREFIX" && git'