🖥
git / gitconfig alias / use command argument
.gitconfig
- Define temporary function. in this example "f"
- Will called soon temporary function without any args. because implicit used git command args.
- You can define same temporary function name like "f" multiple times. it will be not conflicted.
[alias]
checkout-and-say-hello = "!f() { git checkout \"$1\" && echo Hello; }; f"
checkout-and-say-wow = "!f() { git checkout \"$1\" && echo Wow; }; f"
Run
$ git checkout-and-say-wow master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Wow
$ git checkout-and-say-hello master
Already on 'master'
Your branch is up to date with 'origin/master'.
Hello
Ref
command - Git alias with positional parameters - Stack Overflow
Original by Github issue
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。
公開日時
2020-01-01
Discussion