Including the current branch name in the commit template

后端 未结 3 1450
轻奢々
轻奢々 2020-12-05 14:31

I have a commit template set up for git, and I would like to include the name of the current branch in it. I usually set up the branch to be the bug id, and it would help me

3条回答
  •  忘掉有多难
    2020-12-05 15:02

    A solution using git alias but no template:

    $ git config --global alias.com '!sh -c "bug=`git symbolic-ref HEAD|sed s#refs/heads/##`; git commit -em \"BUG: \${bug}\""'
    $ git com
    

提交回复
热议问题