Git 常用命令
· 阅读需 1 分钟
git log
--since 语法
- 绝对日期格式
YYYY-MM-DDMonth Day, YearYYYY-MM-DD HH:mm:ss
- 相对时间格式
N year/months/weeks/days/hours/minutes/seconds agoyesterday/today
--until--before结合--since即>=--until, 即<
从今天开始,过去 1 个月的提交
git log --since="1 month ago"
一行显示
git log --since="2025-06-01" --until="2025-07-01" --oneline
自定义输出
# %h commit hash 的缩写
# %an 作者
# %ar 提交的相对时间
# %s 提交信息
git log --since="1 month ago" --pretty=format:"%h - %an, %ar : %s"
图形化显示
git log --since="1 month ago" --graph --oneline