Git alias to add prefix to name of new branch

家住魔仙堡 提交于 2019-12-13 01:15:13

问题


Is there a way to write an alias that adds current date to name of new branch?

For example:

git branch-today new_branch_name

should create new branch with 22_09_2015_new_branch_name name.


回答1:


Create a git alias and add it to your .gitconfig

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

git branch-today foo

Git branch output:

  22-09-2015_foo
* master


来源:https://stackoverflow.com/questions/32719966/git-alias-to-add-prefix-to-name-of-new-branch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!