git alias - Git config file local variables -


i have set of aliases different type of logs, like:

lg = log --graph --pretty=format:'%c(cyan)%h%creset -%c(yellow)%d%creset %s %cgreen(%cr) %c(red)<%an>%creset' --abbrev-commit --date=relative unreleased = !git --no-pager log --graph --pretty=format:'%c(cyan)%h%creset -%c(yellow)%d%creset %s %cgreen(%cr) %c(red)<%an>%creset' --abbrev-commit --date=relative release..master 

there many type of log aliases, of them share same format. how can define local variable content of common parts?

ideally, avoid using environment variable that

as per this question, git-config doesn’t support expansion of variables. can do, however, define alias common parts:

lg = log --graph --pretty=format:'%c(cyan)%h%creset -%c(yellow)%d%creset %s %cgreen(%cr) %c(red)<%an>%creset' --abbrev-commit --date=relative 

then define further aliases shell commands use common alias:

unreleased = !git --no-pager lg release..master 

incidentally, specifying --date=relative has no effect, since %cr in log format definition relative date. means --date=short, example, have no effect. you’ll need use %cd instead if want of other aliases able change date format.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -