Syntax for Git aliases with multiple commands

后端 未结 4 895
滥情空心
滥情空心 2020-12-08 13:42

I want to create a Git alias to perform multiple commands, but I cant find documentation on how this is done.

  1. What is the syntax for Git aliases with multiple
4条回答
  •  -上瘾入骨i
    2020-12-08 13:51

    Say the commands are echo a and echo b (not a and b), to add multiple commands for an alias q:

    From the command line:
    git config alias.q '!echo a; echo b'

    Directly in the configuration file:

    [alias]
        q = "!echo a; echo b"
    

    For more complex things, define a shell function and call it:
    '!f() { echo a ; echo b ; }; f'

    For passing parameters to the commands see:
    Git alias with positional parameters
    Git Alias - Multiple Commands and Parameters

    Based in Jonathan Wakely's comment

提交回复
热议问题