n.r.
n.r.

Reputation: 1900

How to change the path to user-created git-scripts

I wrote a script git-foo, so that now I can run git foo if git-foo can be found under $PATH or in /usr/lib/git-core/.

How can make git look for git-foo in $HOME/scripts/git, where all my other git scripts are, without having to append $HOME/scripts/git to $PATH?

Upvotes: 0

Views: 47

Answers (2)

sleske
sleske

Reputation: 83635

You could add an alias in your git config file which calls the binary. The alias definition can use the full path to the binary. Then the command will work for everyone who has the alias.

Upvotes: 0

Chronial
Chronial

Reputation: 70793

That is not supported by git. But you could replace the git command with a custom wrapper script that adds that path to your $PATH before calling the real git.

Upvotes: 1

Related Questions