分享2个 git alias

2012-06-26 12:39:11 +08:00
 Aben
今天看到酷壳这篇文章《Git显示漂亮日志的小技巧》 http://coolshell.cn/articles/7755.html ,以及这篇 http://coderwall.com/p/euwpig 「墙」。发现比我常用的
git log --stat 更好看,简单看了下 git log 的帮助,写了两条更符合我口味的别名。

[alias]
lg = log --color --graph --pretty=format:'%c(yellow)%h%creset -%cred%d%creset %s %c(bold blue)(%cn %cr)%creset'
ll = log --color --pretty=format:'%c(yellow)%h%creset -%cred%d%creset %s %c(bold blue)(%cn %cr)%creset' --no-merges

--no-merges是不显示merge产生的log(想要显示删除即可), --abbrev-commit 是显示简略 HASH, 等同于format 里的 %h, 所以不必重复添加。

Try:
git lg
git ll
git lg --stat
git ll --stat

我自己看log 比带 -number 参数。

立刻体验:
git log --color --graph --pretty=format:'%c(yellow)%h%creset -%cred%d%creset %s %c(bold blue)(%cn %cr)%creset'

git log --color --pretty=format:'%c(yellow)%h%creset -%cred%d%creset %s %c(bold blue)(%cn %cr)%creset' --no-merges

贴一下Gist, 其实,也没高亮……
http://gist.github.com/2993286
3780 次点击
所在节点    程序员
5 条回复
iceseaboy
2012-06-26 12:45:55 +08:00
沙发~!
期待超越我
vitohe
2012-06-26 13:03:50 +08:00
tig
liuzhoou
2012-06-26 13:05:15 +08:00
rrrrutdk
2012-06-26 13:13:28 +08:00
[alias]
tree = log --graph --decorate

git tree --all
git tree --all --stat
git tree --all --oneline
twocity
2012-11-22 08:57:41 +08:00
thanks~

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/40561

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX