{"id":100,"date":"2024-12-10T14:37:30","date_gmt":"2024-12-10T06:37:30","guid":{"rendered":"http:\/\/trantor.ink:8080\/?p=100"},"modified":"2026-01-20T12:45:29","modified_gmt":"2026-01-20T04:45:29","slug":"git-%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/trantor.ink\/?p=100","title":{"rendered":"git \u5e38\u7528\u547d\u4ee4"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/trantor.ink\/?p=100\/#%E4%BF%AE%E6%94%B9%E5%B7%B2%E6%8F%90%E4%BA%A4%E7%9A%84_comment_message\" >\u4fee\u6539\u5df2\u63d0\u4ea4\u7684 comment message<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/trantor.ink\/?p=100\/#%E5%8F%96%E6%B6%88%E8%B7%9F%E8%B8%AA%E5%B7%B2%E7%BB%8F%E6%8F%90%E4%BA%A4%E7%9A%84%E6%96%87%E4%BB%B6\" >\u53d6\u6d88\u8ddf\u8e2a\u5df2\u7ecf\u63d0\u4ea4\u7684\u6587\u4ef6<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/trantor.ink\/?p=100\/#git_bisect_%E4%BA%8C%E5%88%86%E6%9F%A5%E6%89%BE%E7%94%A8%E6%B3%95\" >git bisect \u4e8c\u5206\u67e5\u627e\u7528\u6cd5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/trantor.ink\/?p=100\/#cherry-pick\" >cherry-pick<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/trantor.ink\/?p=100\/#%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E5%BC%BA%E8%A1%8C%E6%9B%B4%E6%96%B0%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF\" >\u8fdc\u7a0b\u5206\u652f\u5f3a\u884c\u66f4\u65b0\u672c\u5730\u5206\u652f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/trantor.ink\/?p=100\/#%E6%9F%A5%E7%9C%8B_git_%E5%BC%95%E7%94%A8%E6%97%A5%E5%BF%97\" >\u67e5\u770b git \u5f15\u7528\u65e5\u5fd7<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/trantor.ink\/?p=100\/#git_log_%E6%9F%A5%E6%89%BE\" >git log \u67e5\u627e<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/trantor.ink\/?p=100\/#%E6%9F%A5%E7%9C%8B%E6%9F%90%E4%B8%AA%E7%89%B9%E5%AE%9A%E7%9A%84_Merge_Commit_%E5%85%B7%E4%BD%93%E5%BC%95%E5%85%A5%E4%BA%86%E5%93%AA%E4%BA%9B%E6%8F%90%E4%BA%A4%EF%BC%8C%E5%B9%B6%E8%8E%B7%E5%8F%96%E8%BF%99%E4%BA%9B%E6%8F%90%E4%BA%A4%E7%9A%84%E4%BD%9C%E8%80%85%E5%88%97%E8%A1%A8\" >\u67e5\u770b\u67d0\u4e2a\u7279\u5b9a\u7684 Merge Commit \u5177\u4f53\u5f15\u5165\u4e86\u54ea\u4e9b\u63d0\u4ea4\uff0c\u5e76\u83b7\u53d6\u8fd9\u4e9b\u63d0\u4ea4\u7684\u4f5c\u8005\u5217\u8868<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/trantor.ink\/?p=100\/#%E6%96%B9%E6%B3%95%E4%B8%80%EF%BC%9A%E4%BD%BF%E7%94%A8%E5%91%BD%E4%BB%A4%E8%A1%8C_%E6%9C%80%E6%8E%A8%E8%8D%90%EF%BC%8C%E7%81%B5%E6%B4%BB\" >\u65b9\u6cd5\u4e00\uff1a\u4f7f\u7528\u547d\u4ee4\u884c (\u6700\u63a8\u8350\uff0c\u7075\u6d3b)<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/trantor.ink\/?p=100\/#1_%E4%BB%85%E6%9F%A5%E7%9C%8B%E4%BD%9C%E8%80%85%E5%90%8D%E5%8D%95_%E5%8E%BB%E9%87%8D\" >1. \u4ec5\u67e5\u770b\u4f5c\u8005\u540d\u5355 (\u53bb\u91cd)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/trantor.ink\/?p=100\/#2_%E6%9F%A5%E7%9C%8B%E4%BD%9C%E8%80%85%E5%90%8D%E5%8D%95%E5%8F%8A%E6%8F%90%E4%BA%A4%E6%AC%A1%E6%95%B0\" >2. \u67e5\u770b\u4f5c\u8005\u540d\u5355\u53ca\u63d0\u4ea4\u6b21\u6570<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/trantor.ink\/?p=100\/#3_%E6%9F%A5%E7%9C%8B%E8%AF%A6%E7%BB%86%E5%88%97%E8%A1%A8_%E5%93%88%E5%B8%8C_%E4%BD%9C%E8%80%85_%E6%8F%90%E4%BA%A4%E4%BF%A1%E6%81%AF\" >3. \u67e5\u770b\u8be6\u7ec6\u5217\u8868 (\u54c8\u5e0c + \u4f5c\u8005 + \u63d0\u4ea4\u4fe1\u606f)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/trantor.ink\/?p=100\/#4_%E6%8C%89%E4%BD%9C%E8%80%85%E6%9F%A5%E7%9C%8B%E4%B8%8D%E5%90%8C%E4%BD%9C%E8%80%85%E4%BF%AE%E6%94%B9%E7%9A%84%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8\" >4. \u6309\u4f5c\u8005\u67e5\u770b\u4e0d\u540c\u4f5c\u8005\u4fee\u6539\u7684\u6587\u4ef6\u5217\u8868<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/trantor.ink\/?p=100\/#5_%E6%8C%89%E4%BD%9C%E8%80%85%E3%80%81%E6%8F%90%E4%BA%A4%E8%AE%B0%E5%BD%95%E3%80%81%E4%BF%AE%E6%94%B9%E7%9A%84%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8%E5%B1%95%E7%A4%BA%E6%95%B0%E6%8D%AE\" >5. \u6309\u4f5c\u8005\u3001\u63d0\u4ea4\u8bb0\u5f55\u3001\u4fee\u6539\u7684\u6587\u4ef6\u5217\u8868\u5c55\u793a\u6570\u636e<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/trantor.ink\/?p=100\/#git_%E7%8A%B6%E6%80%81%E6%B5%81\" >git \u72b6\u6001\u6d41<\/a><\/li><\/ul><\/nav><\/div>\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%BF%AE%E6%94%B9%E5%B7%B2%E6%8F%90%E4%BA%A4%E7%9A%84_comment_message\"><\/span><strong>\u4fee\u6539\u5df2\u63d0\u4ea4\u7684 comment message<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git pull = git fetch + git merge <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8F%96%E6%B6%88%E8%B7%9F%E8%B8%AA%E5%B7%B2%E7%BB%8F%E6%8F%90%E4%BA%A4%E7%9A%84%E6%96%87%E4%BB%B6\"><\/span><strong>\u53d6\u6d88\u8ddf\u8e2a\u5df2\u7ecf\u63d0\u4ea4\u7684\u6587\u4ef6<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git rm --cached -r file <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"git_bisect_%E4%BA%8C%E5%88%86%E6%9F%A5%E6%89%BE%E7%94%A8%E6%B3%95\"><\/span><strong>git bisect \u4e8c\u5206\u67e5\u627e\u7528\u6cd5<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git bisect start [\u7ec8\u70b9] [\u8d77\u70b9] \ngit bisect good\/bad \ngit bisect reset <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"cherry-pick\"><\/span><strong>cherry-pick<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git cherry-pick (commitid1..commitid100] \ngit cherry-pick [commitid1^..commitid100] <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E5%BC%BA%E8%A1%8C%E6%9B%B4%E6%96%B0%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF\"><\/span><strong>\u8fdc\u7a0b\u5206\u652f\u5f3a\u884c\u66f4\u65b0\u672c\u5730\u5206\u652f<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git fetch --all \ngit reset --hard origin\/xxx <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B_git_%E5%BC%95%E7%94%A8%E6%97%A5%E5%BF%97\"><\/span><strong>\u67e5\u770b git \u5f15\u7528\u65e5\u5fd7<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git reflog<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"git_log_%E6%9F%A5%E6%89%BE\"><\/span><strong>git log <\/strong>\u67e5\u627e<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># --author \u6307\u5b9a\u4f5c\u8005\n# --since \u8bb0\u5f55\u5f00\u59cb\u65f6\u95f4\n# --until \u8bb0\u5f55\u7ed3\u675f\u65f6\u95f4\n# --name-only \u5c55\u793a\u6539\u52a8\u7684\u6587\u4ef6\u540d\ngit log --author=shishuangxi_wd --since=\"2024-01-01\" --until=\"2024-12-31\" --name-only<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B%E6%9F%90%E4%B8%AA%E7%89%B9%E5%AE%9A%E7%9A%84_Merge_Commit_%E5%85%B7%E4%BD%93%E5%BC%95%E5%85%A5%E4%BA%86%E5%93%AA%E4%BA%9B%E6%8F%90%E4%BA%A4%EF%BC%8C%E5%B9%B6%E8%8E%B7%E5%8F%96%E8%BF%99%E4%BA%9B%E6%8F%90%E4%BA%A4%E7%9A%84%E4%BD%9C%E8%80%85%E5%88%97%E8%A1%A8\"><\/span><strong>\u67e5\u770b\u67d0\u4e2a\u7279\u5b9a\u7684 Merge Commit \u5177\u4f53\u5f15\u5165\u4e86\u54ea\u4e9b\u63d0\u4ea4\uff0c\u5e76\u83b7\u53d6\u8fd9\u4e9b\u63d0\u4ea4\u7684\u4f5c\u8005\u5217\u8868<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u901a\u5e38\uff0c\u4e00\u4e2a Merge Commit \u6709\u4e24\u4e2a\u7236\u8282\u70b9\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Parent 1 (<code>^1<\/code>)<\/strong>: \u5408\u5e76\u53d1\u751f\u65f6\u6240\u5728\u7684\u76ee\u6807\u5206\u652f\uff08\u4f8b\u5982 <code>main<\/code>\uff09\u3002<\/li>\n\n\n\n<li><strong>Parent 2 (<code>^2<\/code>)<\/strong>: \u88ab\u5408\u5e76\u8fdb\u6765\u7684\u6e90\u5206\u652f\uff08\u4f8b\u5982 <code>feature\/xxx<\/code>\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u6211\u4eec\u8981\u627e\u7684\u5c31\u662f <strong>\u5305\u542b\u5728 Parent 2 \u4e2d\uff0c\u4f46\u4e0d\u5305\u542b\u5728 Parent 1 \u4e2d\u7684\u63d0\u4ea4<\/strong>\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u5177\u4f53\u7684\u64cd\u4f5c\u6b65\u9aa4\u548c\u547d\u4ee4\uff1a<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%96%B9%E6%B3%95%E4%B8%80%EF%BC%9A%E4%BD%BF%E7%94%A8%E5%91%BD%E4%BB%A4%E8%A1%8C_%E6%9C%80%E6%8E%A8%E8%8D%90%EF%BC%8C%E7%81%B5%E6%B4%BB\"><\/span>\u65b9\u6cd5\u4e00\uff1a\u4f7f\u7528\u547d\u4ee4\u884c (\u6700\u63a8\u8350\uff0c\u7075\u6d3b)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u5047\u8bbe\u4f60\u7684 Merge Commit \u7684 SHA \u662f <code>e8d2f9a<\/code> (\u8bf7\u66ff\u6362\u4e3a\u4f60\u5b9e\u9645\u7684 SHA)\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_%E4%BB%85%E6%9F%A5%E7%9C%8B%E4%BD%9C%E8%80%85%E5%90%8D%E5%8D%95_%E5%8E%BB%E9%87%8D\"><\/span>1. \u4ec5\u67e5\u770b\u4f5c\u8005\u540d\u5355 (\u53bb\u91cd)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>\u5982\u679c\u4f60\u53ea\u60f3\u770b <strong>\u201c\u662f\u8c01\u53c2\u4e0e\u4e86\u8fd9\u4e2a\u529f\u80fd\u7684\u5f00\u53d1\u201d<\/strong>\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<p>Bash<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git log e8d2f9a^1..e8d2f9a^2 --format=\"%an\" | sort | uniq\n<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>e8d2f9a^1..e8d2f9a^2<\/code>: \u8868\u793a\u201c\u5728\u7236\u8282\u70b92\u4e2d\u5b58\u5728\uff0c\u4f46\u5728\u7236\u8282\u70b91\u4e2d\u4e0d\u5b58\u5728\u7684\u63d0\u4ea4\u8303\u56f4\u201d\u3002<\/li>\n\n\n\n<li><code>--format=\"%an\"<\/code>: \u4ec5\u8f93\u51fa\u4f5c\u8005\u540d\u5b57 (Author Name)\u3002\u5982\u679c\u4f60\u60f3\u770b\u90ae\u7bb1\uff0c\u7528 <code>%ae<\/code>\u3002<\/li>\n\n\n\n<li><code>| sort | uniq<\/code>: \u5bf9\u7ed3\u679c\u6392\u5e8f\u5e76\u53bb\u91cd\uff0c\u8fd9\u6837\u6bcf\u4e2a\u4f5c\u8005\u53ea\u663e\u793a\u4e00\u6b21\u3002<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_%E6%9F%A5%E7%9C%8B%E4%BD%9C%E8%80%85%E5%90%8D%E5%8D%95%E5%8F%8A%E6%8F%90%E4%BA%A4%E6%AC%A1%E6%95%B0\"><\/span>2. \u67e5\u770b\u4f5c\u8005\u540d\u5355\u53ca\u63d0\u4ea4\u6b21\u6570<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>\u5982\u679c\u4f60\u60f3\u770b\u6bcf\u4e2a\u4f5c\u8005\u8d21\u732e\u4e86\u591a\u5c11\u4e2a Commit\uff1a<\/p>\n\n\n\n<p>Bash<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git log e8d2f9a^1..e8d2f9a^2 --format=\"%an\" | sort | uniq -c | sort -nr\n<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>uniq -c<\/code>: \u7edf\u8ba1\u51fa\u73b0\u7684\u6b21\u6570\u3002<\/li>\n\n\n\n<li><code>sort -nr<\/code>: \u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff08\u8d21\u732e\u6700\u591a\u7684\u5728\u6700\u4e0a\u9762\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_%E6%9F%A5%E7%9C%8B%E8%AF%A6%E7%BB%86%E5%88%97%E8%A1%A8_%E5%93%88%E5%B8%8C_%E4%BD%9C%E8%80%85_%E6%8F%90%E4%BA%A4%E4%BF%A1%E6%81%AF\"><\/span>3. \u67e5\u770b\u8be6\u7ec6\u5217\u8868 (\u54c8\u5e0c + \u4f5c\u8005 + \u63d0\u4ea4\u4fe1\u606f)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>\u5982\u679c\u4f60\u9700\u8981\u4eba\u5de5\u6838\u5bf9\u6bcf\u4e00\u6761\u63d0\u4ea4\uff1a<\/p>\n\n\n\n<p>Bash<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git log e8d2f9a^1..e8d2f9a^2 --format=\"%h - %an : %s\"<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_%E6%8C%89%E4%BD%9C%E8%80%85%E6%9F%A5%E7%9C%8B%E4%B8%8D%E5%90%8C%E4%BD%9C%E8%80%85%E4%BF%AE%E6%94%B9%E7%9A%84%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8\"><\/span>4. \u6309\u4f5c\u8005\u67e5\u770b\u4e0d\u540c\u4f5c\u8005\u4fee\u6539\u7684\u6587\u4ef6\u5217\u8868<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">git log --no-merges --format=\"%an\" dc8b57231^1..dc8b57231^2 | sort -u | while read author; do\n  echo -e \"\\n=== \ud83d\udc64 $author ===\"\n  git log --no-merges --author=\"$author\" --name-only --pretty=format:\"\" dc8b57231^1..dc8b57231^2 | sort -u | grep -v '^$'\ndone<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_%E6%8C%89%E4%BD%9C%E8%80%85%E3%80%81%E6%8F%90%E4%BA%A4%E8%AE%B0%E5%BD%95%E3%80%81%E4%BF%AE%E6%94%B9%E7%9A%84%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8%E5%B1%95%E7%A4%BA%E6%95%B0%E6%8D%AE\"><\/span>5. \u6309\u4f5c\u8005\u3001\u63d0\u4ea4\u8bb0\u5f55\u3001\u4fee\u6539\u7684\u6587\u4ef6\u5217\u8868\u5c55\u793a\u6570\u636e<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># === \u914d\u7f6e\u533a ===\nSTART_COMMIT=\"dc8b57231^1\"  # \u8bf7\u66ff\u6362\u4e3a\u8d77\u59cb Commit\nEND_COMMIT=\"dc8b57231^2\"    # \u8bf7\u66ff\u6362\u4e3a\u7ed3\u675f Commit\n# =============\n\necho \"\u6b63\u5728\u5206\u6790\u4ece $START_COMMIT \u5230 $END_COMMIT \u7684\u6240\u6709\u6587\u4ef6\u53d8\u52a8...\"\n\n# 1. \u7b2c\u4e00\u5c42\u5faa\u73af\uff1a\u83b7\u53d6\u6240\u6709\u53bb\u91cd\u7684\u4f5c\u8005\ngit log --no-merges --format=\"%an\" \"$START_COMMIT..$END_COMMIT\" | sort -u | while read author; do\n    \n    # \u9884\u5148\u6355\u83b7\u8f93\u51fa\n    OUTPUT=$(\n        # 2. \u7b2c\u4e8c\u5c42\uff1a\u83b7\u53d6\u8be5\u4f5c\u8005\u7684 Commit \u4fe1\u606f\u548c\u6587\u4ef6\u5217\u8868\n        # \u4f7f\u7528 --name-only \u5217\u51fa\u6240\u6709\u6587\u4ef6\n        git log --no-merges --author=\"$author\" --name-only \\\n            --pretty=format:\"__COMMIT__|%h|%cd|%s\" \\\n            --date=short \"$START_COMMIT..$END_COMMIT\" | \\\n        \n        # 3. \u7b2c\u4e09\u5c42\uff1a\u4f7f\u7528 awk \u5904\u7406\n        # \u79fb\u9664 -v filter \u53c2\u6570\uff0c\u4e0d\u518d\u8fdb\u884c\u6b63\u5219\u5339\u914d\n        awk -F'|' '\n            # \u9047\u5230 Commit \u5934\u4fe1\u606f\n            \/^__COMMIT__\/ { \n                current_header = \"  \ud83d\udd38 [\" $2 \"] \" $3 \" : \" $4\n                header_printed = 0 \n                next \n            }\n            \n            # \u9047\u5230\u7a7a\u884c\u8df3\u8fc7 (NF\u8868\u793a\u5b57\u6bb5\u6570\uff0c0\u8868\u793a\u7a7a\u884c)\n            !NF { next }\n\n            # \u9047\u5230\u4efb\u4f55\u5176\u4ed6\u884c\uff08\u5373\u6587\u4ef6\u540d\uff09\uff0c\u76f4\u63a5\u6253\u5370\n            {\n                # \u5982\u679c\u5f53\u524d\u63d0\u4ea4\u7684\u5934\u8fd8\u6ca1\u6253\u5370\u8fc7\uff0c\u5148\u6253\u5370\u5934\n                if (header_printed == 0) {\n                    print \"\"            \n                    print current_header\n                    header_printed = 1\n                }\n                # \u6253\u5370\u6587\u4ef6\u540d\n                print \"       \ud83d\udcc4 \" $0\n            }\n        '\n    )\n\n    # \u53ea\u8981\u6709\u8f93\u51fa\u5c31\u6253\u5370\u4f5c\u8005\u5757\n    if [ ! -z \"$OUTPUT\" ]; then\n        echo -e \"\\n========================================\"\n        echo -e \"\ud83d\udc64 \u4f5c\u8005: $author\"\n        echo -e \"========================================\"\n        echo \"$OUTPUT\"\n    fi\n\ndone<\/pre>\n\n\n\n<p>git log<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"git_%E7%8A%B6%E6%80%81%E6%B5%81\"><\/span><strong>git \u72b6\u6001\u6d41<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/blog-1256162814.cos.ap-nanjing.myqcloud.com\/wordpress\/5e3c49617e0936a2983d0a2526d23fc9.png\" alt=\"\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u4fee\u6539\u5df2\u63d0\u4ea4\u7684 comment message \u53d6\u6d88\u8ddf\u8e2a\u5df2\u7ecf\u63d0\u4ea4\u7684\u6587\u4ef6 git bisect \u4e8c\u5206\u67e5\u627e\u7528\u6cd5 cherry-pick \u8fdc\u7a0b\u5206\u652f\u5f3a\u884c\u66f4\u65b0\u672c\u5730\u5206\u652f \u67e5\u770b git \u5f15\u7528\u65e5\u5fd7 git log \u67e5\u627e \u67e5\u770b\u67d0\u4e2a\u7279\u5b9a\u7684 Merge Commit \u5177\u4f53\u5f15\u5165\u4e86\u54ea\u4e9b\u63d0\u4ea4\uff0c\u5e76\u83b7\u53d6\u8fd9\u4e9b\u63d0\u4ea4\u7684\u4f5c\u8005\u5217\u8868 \u901a\u5e38\uff0c\u4e00\u4e2a Merge Commit \u6709\u4e24\u4e2a\u7236\u8282\u70b9\uff1a \u6211\u4eec\u8981\u627e\u7684\u5c31\u662f \u5305\u542b\u5728 Parent 2 \u4e2d\uff0c\u4f46\u4e0d\u5305\u542b\u5728 Parent 1 \u4e2d\u7684\u63d0\u4ea4\u3002 \u4ee5\u4e0b\u662f\u5177\u4f53\u7684\u64cd\u4f5c\u6b65\u9aa4\u548c\u547d\u4ee4\uff1a \u65b9\u6cd5\u4e00\uff1a\u4f7f\u7528\u547d\u4ee4\u884c (\u6700\u63a8\u8350\uff0c\u7075\u6d3b) \u5047\u8bbe\u4f60\u7684 Merge Commit \u7684 SHA \u662f e8d2f9a (\u8bf7\u66ff\u6362\u4e3a\u4f60\u5b9e\u9645\u7684 SHA)\u3002 1. \u4ec5\u67e5\u770b\u4f5c\u8005\u540d\u5355 (\u53bb\u91cd) \u5982\u679c\u4f60\u53ea\u60f3\u770b \u201c\u662f\u8c01\u53c2\u4e0e\u4e86\u8fd9\u4e2a\u529f\u80fd\u7684\u5f00\u53d1\u201d\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a Bash 2. \u67e5\u770b\u4f5c\u8005\u540d\u5355\u53ca\u63d0\u4ea4\u6b21\u6570 \u5982\u679c\u4f60\u60f3\u770b\u6bcf\u4e2a\u4f5c\u8005\u8d21\u732e\u4e86\u591a\u5c11\u4e2a Commit\uff1a Bash 3. \u67e5\u770b\u8be6\u7ec6\u5217\u8868 (\u54c8\u5e0c + \u4f5c\u8005 + \u63d0\u4ea4\u4fe1\u606f) \u5982\u679c\u4f60\u9700\u8981\u4eba\u5de5\u6838\u5bf9\u6bcf\u4e00\u6761\u63d0\u4ea4\uff1a Bash 4. \u6309\u4f5c\u8005\u67e5\u770b\u4e0d\u540c\u4f5c\u8005\u4fee\u6539\u7684\u6587\u4ef6\u5217\u8868 5. \u6309\u4f5c\u8005\u3001\u63d0\u4ea4\u8bb0\u5f55\u3001\u4fee\u6539\u7684\u6587\u4ef6\u5217\u8868\u5c55\u793a\u6570\u636e git log git \u72b6\u6001\u6d41<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[14],"class_list":["post-100","post","type-post","status-publish","format-standard","hentry","category-15","tag-git"],"_links":{"self":[{"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/posts\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/trantor.ink\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=100"}],"version-history":[{"count":6,"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/posts\/100\/revisions"}],"predecessor-version":[{"id":643,"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/posts\/100\/revisions\/643"}],"wp:attachment":[{"href":"https:\/\/trantor.ink\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trantor.ink\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trantor.ink\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}