git log根据特定条件查询日志并统计修改的代码行数
$ git log -2 arm commit 7329cc39818a05c168e7d1e791afb03c089f1933 (origin/arm, arm) Author: Salvatore Sanfilippo <antirez@gmail.com> Date: Sun Feb 19 15:07:08 2017 +0000 ARM: Avoid fast path for BITOP. GCC will produce certain unaligned multi load-store instructions that will be trapped by the Linux kernel since ARM v6 cannot handle them with unaligned addresses. Better to use the slower but safer implementation instead of generating the exception which should be anyway very slow. commit 4e9cf4cc7ed4b732fc4bb592f19ceb41d132954e Author: Salvatore Sanfilippo <antirez@gmail.com> Date: Sun Feb 19 15:02:37 2017 +0000 ARM: Use libc malloc by default. I'm not sure how much test Jemalloc gets on ARM, moreover compiling Redis with Jemalloc support in not very powerful devices, like most ARMs people will build Redis on, is extremely slow. It is possible to enable Jemalloc build anyway if needed by using "make MALLOC=jemalloc". 其实在 git 体系中,分支名、commit、标签等拥有几乎相同的含义,所以在很多场景下可以扩展互换,比如 git log 后面加上分支名就可以查询指定分支的提交记录,如果加上 commit 就会查询这个 commit 之前的提交记录,如果加上标签,就可以查询这个标签之前的提交记录,比如我们加一个 commit 试试: $ git log -2 7329cc39818a05c168e7d1e791afb03c089f1933 commit 7329cc39818a05c168e7d1e791afb03c089f1933 (origin/arm, arm) Author: Salvatore Sanfilippo <antirez@gmail.com> Date: Sun Feb 19 15:07:08 2017 +0000 ARM: Avoid fast path for BITOP. GCC will produce certain unaligned multi load-store instructions that will be trapped by the Linux kernel since ARM v6 cannot handle them with unaligned addresses. Better to use the slower but safer implementation instead of generating the exception which should be anyway very slow. commit 4e9cf4cc7ed4b732fc4bb592f19ceb41d132954e Author: Salvatore Sanfilippo <antirez@gmail.com> Date: Sun Feb 19 15:02:37 2017 +0000 ARM: Use libc malloc by default. I'm not sure how much test Jemalloc gets on ARM, moreover compiling Redis with Jemalloc support in not very powerful devices, like most ARMs people will build Redis on, is extremely slow. It is possible to enable Jemalloc build anyway if needed by using "make MALLOC=jemalloc". 因为 commit id 就是之前的 arm 分支最新的记录,所以这个命令等价于 git log -2 arm 查询指定 commit 之间的提交记录 如果想查询两个 commit 之前的提交记录,可以将两个 commit id 依次放在命令后面并用 .. 连接就可以了,格式为 git log commit1..commit2,需要注意的是这样查询出来的提交记录列表中不包含 commit1,其实列举出的就是 commit1 之后又做了哪些修改提交。 $ git log e15528bf1da1f1232fd08801ad382c915be94662..7bf665f125a4771db095c83a7ad6ed46692cd314 commit 7bf665f125a4771db095c83a7ad6ed46692cd314 (HEAD -> 6.0, tag: 6.0.6, origin/6.0) Author: Oran Agra <oran@redislabs.com> Date: Sun Jul 19 14:00:20 2020 +0300 Redis 6.0.6. commit a5696bdf4f2687ab45f633ccb7cdc4ee9c2f957d Author: Oran Agra <oran@redislabs.com> Date: Sun Jul 19 15:33:21 2020 +0300 Run daily CI on PRs to release a branch 这个特性有一个应用就是在 merge 分支之前可以查询究竟会 merge 哪些记录,常见的用法比如 git log feature..dev 就是列举出 feature 分支合并到 dev 分支将要合并的提交记录有哪些。 (编辑:惠州站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |