Git别名为新分支的名称添加前缀 [英] Git alias to add prefix to name of new branch

查看:288
本文介绍了Git别名为新分支的名称添加前缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

例如:

git branch-today new_branch_name

应使用22_09_2015_new_branch_name名称创建新分支.

should create new branch with 22_09_2015_new_branch_name name.

推荐答案

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

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分支输出:

  22-09-2015_foo
* master

这篇关于Git别名为新分支的名称添加前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆