If I define a git alias that executes an external script is there any way to get the original CWD? I know external scripts always execute at the root of the repo so I was just wondering if there was an env variable or something I could use to figure out where I ran my script.
Here is an example alias:
git config --global alias.here '!echo pwd `pwd`'
/home/me/repo/folder$ git here
pwd /home/me/repo
I'm looking for something that does the following:
git config --global alias.here '!echo pwd $OLD_PWD'
/home/me/repo/folder$ git here
pwd /home/me/repo/folder
As per the manual, you should be able to use GIT_PREFIX
, which will be set with the same prefix as returned by git rev-parse --show-prefix
. You can append that prefix to the root path.
http://schacon.github.com/git/git-config.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With