Git 别名,为新分支的名称添加前缀

Git alias to add prefix to name of new branch

有没有办法编写一个别名,将当前日期添加到新分支的名称中?

例如:

git branch-today new_branch_name

应该创建名称为 22_09_2015_new_branch_name 的新分支。

创建一个 git 别名并将其添加到您的 .gitconfig

[alias]
        branch-today = "!bt() { git branch $(date +%d-%m-%Y)_;}; bt"

git branch-today foo

Git 分支输出:

  22-09-2015_foo
* master