# Effects of alias not changing the directory

1 messages from 2008-03-24 to 2008-03-24. Participants: Logan Kennelly.
Thread: https://gitlist.dev/t/12835

## Logan Kennelly, 2008-03-24 05:27

Subject: Effects of alias not changing the directory
Message-ID: <64DCCD62-D432-4076-9CD6-337EEB82FCCE@sent.com>
URL: https://gitlist.dev/e/64DCCD62-D432-4076-9CD6-337EEB82FCCE%40sent.com

```
At the request of some of my coworkers, I created a wrapper script that
allows them to use a graphical diff tool when they wish. I  
effectively add a
new command through the use of an alias:

  [alias]
   exdiff = "!GIT_EXTERNAL_DIFF=git_exdiff.sh GIT_PAGER=cat git diff"

This command works extremely well when run by itself (`git exdiff`) but
fails when run from a subdirectory and given a relative path because the
alias machinery changes the current directory as demonstrated here:

  [alias]
   echopath = "!echo $PWD"

   $ cd /path/git_tracked/a/b
   $ git echopath
   /path/git_tracked

Is there a reason for this behavior? I'd like to submit a patch, but I'm
concerned that I'm missing something. If it helps, I believe it is the
setup_git_directory_gently logic (called from handle_alias) that  
results in
the chdir.

Thank you.

```
