Search code examples
gitmsysgit

How to make git recognise a folder for custom commands?


I have a custom git command (specifically git-tfs - I don't want to install via chocolatey) I would like have this custom command in separate folder (C:\Program Files (x86)\Git\extensions\GitTfs). I know that I can just add this folder to the system path, but I want to isolate the git settings to the git folder.

I have tried to set the git --exec-path:

git --exec-path="c:\Program Files (x86)\Git/libexec/git-core;c:\Program Files (x86)\Git/extensions/GitTfs"

and

git --exec-path="/c/Program Files (x86)/Git/libexec/git-core:/c/Program Files (x86)/Git/extensions/GitTfs"

But I get: usage: git.....

Can I add more than one folder as git --exec-path? (or have my custom git command in a separate folder in any other way.)


Solution

  • @chepner's answer is conceptually correct, but the path must be to the executable file. So the correct syntax is:

    git config --global alias.tfs !'C:\Program Files (x86)\Git\extensions\GitTfs\git-tfs.exe'