我在自己的机器上单独使用Git,我发现很难维护所有分支和提交的心理模型。我知道我可以通过git日志查看提交历史,但是有没有一种方法可以查看整个分支地形,就像这些ASCII映射一样,似乎到处都在用它来解释分支?
.-A---M---N---O---P
/ / / / /
I B C D E
\ / / / /
`-------------'
感觉就像有人来找我的存储库时,很难弄清楚到底发生了什么。
我猜我是受到了AccuRev的流媒体浏览器的影响…
我99.999%的时间用gitlg来查看历史,0.001%用gitlog来查看历史。
我只是想分享两个可能有用的日志别名(从.gitconfig配置):
[Alias]
lg = log --graph --pretty=format:'%Cred%h%Creset %ad %s %C(yellow)%d%Creset %C(bold blue)<%an>%Creset' --date=short
hist = log --graph --full-history --all --pretty=format:'%Cred%h%Creset %ad %s %C(yellow)%d%Creset %C(bold blue)<%an>%Creset' --date=short
Git lg将看到当前的分支历史记录。
Git hist将看到整个分支历史。
Git内置的工具(没有附加组件)具有日期时间格式
现有的答案都没有显示如何使用内置的git日志工具更改日期-时间格式。由于文档对这个特性有点迟钝,我添加了两个别名作为示例。
git树-所有提交的时间戳日志
# Tools for analyzing the merge history of a repo using tree-like graphics
[alias]
tree = log --no-show-signature --graph --date=format-local:%H:%M:%S --all \
--pretty="'%C(#ffe97b ul)%h%C(reset) %C(#568ea6)%cs %C(#305f72)%cd%C(reset)%C(auto)%d%C(reset) %s %C(yellow)(%C(reset)%C(#1abc9c)%an%C(reset)%C(yellow),%C(reset) %C(#007055)%cr%C(reset)%C(yellow))%C(reset)'"
git树。分支——所有分支/标签提交的时间戳日志
# Some refinements to normal 'git tree' output for alternative perspectives.
[alias "tree"]
branches = tree --simplify-by-decoration
颜色代码
Spec |
Color |
Style |
Commit ID |
Yellow |
Underline |
Commit date |
Dark Blue |
|
Commit time |
Light Blue |
|
Commit message |
White |
|
Commit Author |
Green |
|
Commit relative date |
Dark Green |
|
Remote branches |
Red |
|
Local branches |
Purple |
|
Tags |
Pink |
Underline |