Git alias with shell variable expansions

后端 未结 2 1430
無奈伤痛
無奈伤痛 2020-12-21 01:58

I\'d like to use a shell variable expansion inside of a git alias to strip a prefix of a branch. Unfortunately when I use the \"standard\" alias, variable expansion is not d

2条回答
  •  旧时难觅i
    2020-12-21 02:35

    Low-level explanation: The ${xxx} syntax always requires a variable name for xxx. It does not substitute an arbitrary string. To use ##, one would have to: x=$(git symbolic-ref HEAD); echo ${x##refs/heads/};

提交回复
热议问题