分支来回合并以后,单看提交列表有时候不太直观,可以先画个很轻量的提交图。
环境:Git 2.25+,在仓库根目录执行:
git log --oneline --decorate --graph --all -n 30
--oneline 让每个提交占一行,--decorate 会把分支名和 tag 标出来,--graph 负责画左边那条分叉线。-n 30 只是限制最近 30 条,避免一下刷太长。
如果只想看当前分支附近,可以去掉 --all:
git log --oneline --decorate --graph -n 20
这个命令只读历史,不会改仓库。排查“这个分支到底从哪叉出去的”时,比直接翻完整 hash 舒服一点。