I want to set a specific alias in .gitconfig
to a bash script like this:
[alias]
example = "~/git-scripts/example-script.sh"
instead of:
[alias]
example = "!f() { arg1=$1; echo $arg1; }; f"
So, the echo script above would be in this file ~/git-scripts/example-script.sh
When i'm trying to execute a alias like this, i got this error:
expansion of alias 'example' failed; ~/git-scripts/example-script.sh is not a git command
What's wrong?
As Charles Duffy said in the comments area, i could make it work like this:
[alias]
example = "! ~/git-scripts/example-script"
Just add !
before the script path
Be careful with:
$ chmod +x YOUR_SCRIPT_PATH
.sh
) at the script file. You can read more about this here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.