Git 包含类似于 magit 的时间的别名
Git alias to include time similar to magit
我使用以下我非常喜欢的别名:
git config --global alias.dag 'log --oneline --decorate --all --graph'
它给了我一些东西link这个:
* 1234 (HEAD->master, origin/master) Commit Message
当我使用 emacs magit 时,我还得到了用户名和提交日期:
* 1234 (HEAD->master, origin/master) Commit Message MyName date
有人知道修改别名以提供额外信息的最佳方法吗?
如果它像 emacs 那样按列对齐,它也会有所帮助。
你可以这样做:
git config --global alias.dag 'log --pretty=format:"%C(green)%h\ %C(yellow)[%ad]%Cred%d\ %Creset%s%Cblue\ [%cn]" --decorate --date=local'
这为您提供了一个包含您想要的列的漂亮的一行。为了清楚起见,每一列也是不同的颜色。
--date=local
将显示当前日期和时间,但您可以使用带有 --date
标志的其他选项:--date=(relative|local|default|iso|rfc|short|raw)
有关 git log --date
的更多信息可在此处找到:How to change git log date formats
"Commit Formatting" section of git log
文档提供了所有答案。
此命令生成您需要的无颜色输出:
git log --all --graph --format="%H %d %s %cn %cd"
格式占位符:
%H
- 提交哈希;使用 %h
获取缩写的提交哈希;
%d
- 参考名称,如 --decorate
选项产生;
%s
- 提交主题;
%cn
- 提交者姓名;
%cd
- 提交者日期(格式遵循 --date=
选项);
使用 %cD
、%ct
、%cr
, %ci
、%cI
其他格式。
在文档的 "Pretty Formats" 部分阅读有关格式占位符的更多信息。
效果很好,感谢你们的精彩开始:
git config --global alias.dag 'git log --pretty=format:"%C(blue)%h %C(green)%d %<(60)%Creset%s %<(20)%C(yellow)%cn %C(green)%ad" --decorate --all --graph --date=local'
我使用以下我非常喜欢的别名:
git config --global alias.dag 'log --oneline --decorate --all --graph'
它给了我一些东西link这个:
* 1234 (HEAD->master, origin/master) Commit Message
当我使用 emacs magit 时,我还得到了用户名和提交日期:
* 1234 (HEAD->master, origin/master) Commit Message MyName date
有人知道修改别名以提供额外信息的最佳方法吗? 如果它像 emacs 那样按列对齐,它也会有所帮助。
你可以这样做:
git config --global alias.dag 'log --pretty=format:"%C(green)%h\ %C(yellow)[%ad]%Cred%d\ %Creset%s%Cblue\ [%cn]" --decorate --date=local'
这为您提供了一个包含您想要的列的漂亮的一行。为了清楚起见,每一列也是不同的颜色。
--date=local
将显示当前日期和时间,但您可以使用带有 --date
标志的其他选项:--date=(relative|local|default|iso|rfc|short|raw)
有关 git log --date
的更多信息可在此处找到:How to change git log date formats
"Commit Formatting" section of git log
文档提供了所有答案。
此命令生成您需要的无颜色输出:
git log --all --graph --format="%H %d %s %cn %cd"
格式占位符:
%H
- 提交哈希;使用%h
获取缩写的提交哈希;%d
- 参考名称,如--decorate
选项产生;%s
- 提交主题;%cn
- 提交者姓名;%cd
- 提交者日期(格式遵循--date=
选项);
使用%cD
、%ct
、%cr
,%ci
、%cI
其他格式。
在文档的 "Pretty Formats" 部分阅读有关格式占位符的更多信息。
效果很好,感谢你们的精彩开始:
git config --global alias.dag 'git log --pretty=format:"%C(blue)%h %C(green)%d %<(60)%Creset%s %<(20)%C(yellow)%cn %C(green)%ad" --decorate --all --graph --date=local'