\u6211\u4eec\u5982\u4f55\u627e\u51fa\u5408\u5e76\u540e\u7684\u5206\u652f\u4e0e\u5408\u5e76\u524d\u5206\u652f\u7684\u5dee\u5f02\u5462?\u8fd9\u91cc\u6211\u4eec\u9700\u8981\u4f7f\u7528\u5230 git log \u547d\u4ee4\u4e86\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\u524d\u4e24\u5929\u5728\u505a\u96c6\u6210\u7684\u65f6\u5019\u78b0\u5230\u4e86\u4e00\u4ef6\u95f9\u5fc3\u4e8b\u3002\u4e8b\u60c5\u662f\u8fd9\u6837\u7684\uff0c\u826f\u8bb8\u7684\u4e00\u4f4d\u540c\u4e8b\u4e0d\u5c0f\u5fc3\u628a\u4e00\u4e2a\u9519\u8bef\u7684 dev \u5206\u652f merge \u5230\u4e86 master \u5206\u652f\u4e0a\uff0c\u5bfc\u81f4\u4e86\u826f\u8bb8\u7f16\u8bd1\u4e0d\u901a\u8fc7\u3002\u4e8e\u662f\uff0c\u6211\u4eec\u9700\u8981\u5c06\u7248\u672c\u56de\u9000\u5230 merge \u4e4b\u524d\u7684\u72b6\u6001\u3002<\/p>\n
\u5982\u679c\u662f\u4e0b\u9762\u8fd9\u4e2a\u72b6\u6001\uff0c\u90a3\u5f88\u597d\u5904\u7406\uff1a<\/p>\n
<\/p>\n
\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u53ea\u9700\u4e00\u4e2a git reset \u547d\u4ee4\u5373\u53ef\uff1a<\/p>\n
git reset --hard HEAD~ \r\n<\/pre>\n\u4f46\u662f\uff0c\u5982\u679c\u4e0b\u9762\u8fd9\u79cd\u72b6\u6001\uff0c\u60c5\u51b5\u5c31\u6ca1\u90a3\u4e48\u7b80\u5355\u4e86\uff1a<\/p>\n
<\/p>\n
\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5c31\u4e0d\u80fd\u7b80\u5355\u4f7f\u7528 git reset \u547d\u4ee4\u4e86\u3002\u8fd9\u5c31\u662f\u826f\u8bb8\u8fd9\u6b21\u78b0\u5230\u7684\u95ee\u9898\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u5c31\u9700\u8981\u627e\u51fa\u5408\u5e76\u540e\u7684\u5206\u652f\u4e0e\u5408\u5e76\u524d\u7684\u5206\u652f\u7684\u5dee\u5f02\uff0c\u518d\u8fdb\u884c\u7248\u672c\u56de\u9000\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\u7684\u7248\u672c\u56de\u9000\uff0c\u5c31\u4e0d\u80fd\u5355\u7528 git reset \u4e86\uff0c\u800c\u662f\u8981\u914d\u5408 git revert \u4e86\uff0c\u5728\u540e\u9762\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f18\u96c5\u7684\u8fdb\u884c\u7248\u672c\u56de\u9000\u3002<\/p>\n
\u56de\u5230\u6b63\u9898\uff0c\u6211\u4eec\u5982\u4f55\u627e\u51fa\u5408\u5e76\u540e\u7684\u5206\u652f\u4e0e\u5408\u5e76\u524d\u5206\u652f\u7684\u5dee\u5f02\u5462?\u8fd9\u91cc\u6211\u4eec\u9700\u8981\u4f7f\u7528\u5230 git log \u547d\u4ee4\u4e86\u3002\u6211\u4eec\u5148\u6a21\u62df\u51fa\u8fd9\u4e24\u4e2a\u5206\u652f\u7684\u63d0\u4ea4\u60c5\u51b5\uff1a<\/p>\n
dev \u5206\u652f\u63d0\u4ea4\u60c5\u51b5\uff1a<\/strong><\/p>\n\r\n[alvin@VM_0_16_centos git-log]$ git log dev \r\ncommit b191410906ae20a865fde3f163bb01fd6cfc1f11 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 21:03:13 2018 +0800 \r\n [dev] \u7248\u672c6 \r\ncommit 793c9582ab0a45c4f8f548be36c06bc5ca427c62 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 21:02:30 2018 +0800 \r\n [dev] \u7248\u672c5 \r\ncommit dbe54166608772486408c1dea05304de45dba430 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 21:00:27 2018 +0800 \r\n [both] \u7248\u672c3 \r\ncommit 31894364b1396b00d2935373387397ef930416e4 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 20:59:26 2018 +0800 \r\n [both] \u7248\u672c2 \r\ncommit 4872f653a8fd7c8541abb4a292d628dc7625884b \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 20:58:05 2018 +0800 \r\n [dev] \u7248\u672c4 \r\ncommit fac6c60ed28c5acfcd01284336d4201cc55ee2e7 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 20:57:01 2018 +0800 \r\n [both] \u7248\u672c1 <\/pre>\nmaster \u5206\u652f\u63d0\u4ea4\u60c5\u51b5\uff1a<\/strong><\/p>\n\r\n[alvin@VM_0_16_centos git-log]$ git log master \r\ncommit c690054c67b833b22dce4120899526743b20d36d \r\nAuthor: Liangxu \r\nDate: Sun Dec 9 07:31:47 2018 +0800 \r\n [master] \u7248\u672c7 \r\ncommit dbe54166608772486408c1dea05304de45dba430 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 21:00:27 2018 +0800 \r\n [both] \u7248\u672c3 \r\ncommit 31894364b1396b00d2935373387397ef930416e4 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 20:59:26 2018 +0800 \r\n [both] \u7248\u672c2 \r\ncommit fac6c60ed28c5acfcd01284336d4201cc55ee2e7 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 20:57:01 2018 +0800 \r\n [both] \u7248\u672c1 \r\n<\/pre>\n\u5728\u8fd9\u4e9b\u63d0\u4ea4\u91cc [both] \u8868\u793a\u4e24\u4e2a\u5206\u652f\u90fd\u6709\u7684\u63d0\u4ea4\uff0c [dev] \u8868\u793a\u53ea\u6709\u5728 dev \u5206\u652f\u7684\u63d0\u4ea4\uff0c[master] \u8868\u793a\u53ea\u5728 master \u5206\u652f\u7684\u63d0\u4ea4<\/p>\n
1. \u67e5\u770bdev\u6709\uff0c\u800c master \u5206\u652f\u6ca1\u6709\u7684\u63d0\u4ea4<\/strong><\/div>\n\u65b9\u6cd5\u4e00<\/strong><\/p>\n\u547d\u4ee4\uff1a<\/p>\n
git log dev ^master <\/pre>\n\u7ed3\u679c\uff1a<\/p>\n
[alvin@VM_0_16_centos git-log]$ git log dev ^master \r\ncommit b191410906ae20a865fde3f163bb01fd6cfc1f11 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 21:03:13 2018 +0800 \r\n [dev] \u7248\u672c6 \r\ncommit 793c9582ab0a45c4f8f548be36c06bc5ca427c62 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 21:02:30 2018 +0800 \r\n [dev] \u7248\u672c5 \r\ncommit 4872f653a8fd7c8541abb4a292d628dc7625884b \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 20:58:05 2018 +0800 \r\n [dev] \u7248\u672c4 <\/pre>\n\u5f88\u660e\u663e\u770b\u5230\uff0c\u7248\u672c4\uff0c5\uff0c6\u8fd9\u4e09\u4e2a\u63d0\u4ea4\u53ea\u5728 dev \u5206\u652f\u91cc\u3002<\/p>\n
\u76f8\u53cd\uff0c\u5982\u679c\u60f3\u770b\u5230 master \u5206\u652f\u6709\uff0c\u800c dev \u5206\u652f\u6ca1\u6709\u7684\u63d0\u4ea4\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n
git log master ^dev <\/pre>\n\u7ed3\u679c\uff1a<\/p>\n
\r\n[alvin@VM_0_16_centos git-log]$ git log master ^dev \r\ncommit c690054c67b833b22dce4120899526743b20d36dAuthor: Liangxu Date: Sun Dec 9 07:31:47 2018 +0800 \r\n [master] \u7248\u672c7 <\/pre>\n\u65b9\u6cd5\u4e8c<\/strong><\/p>\n\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n
git log master..dev <\/pre>\n\u5982\u679c\u60f3\u67e5\u770b\u53ea\u5728 master \u5206\u652f\uff0c\u800c\u4e0d\u5728 dev \u5206\u652f\u7684\u63d0\u4ea4\uff0c\u5219\u5c06 master \u4e0e dev \u5bf9\u8c03\u8fc7\u6765\u5373\u53ef\uff1a<\/p>\n
git log dev..master <\/pre>\n\u8fd9\u4e24\u6761\u547d\u4ee4\u7684\u6267\u884c\u7ed3\u679c\u4e0e\u4e0a\u8ff0\u76f8\u540c\uff0c\u6545\u4e0d\u91cd\u590d\u8d34\u7ed3\u679c\u4e86\u3002<\/p>\n
2. \u63d0\u524d\u672a\u77e5\u4e24\u4e2a\u5206\u652f\u63d0\u4ea4\u60c5\u51b5\uff0c\u5982\u4f55\u67e5\u770b\u4e24\u4e2a\u5206\u652f\u7684\u5dee\u5f02?<\/strong><\/div>\n\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4e0a\u8ff0\u7684\u51e0\u4e2a\u547d\u4ee4\u90fd\u8dd1\u4e00\u904d\uff0c\u5176\u5b9e\u4e5f\u53ef\u4ee5\u77e5\u9053\u4e2a\u5927\u6982\u4e86\u3002\u4f46\u6709\u6ca1\u6709\u66f4\u7b80\u5355\u7684\u529e\u6cd5\u5462?git \u540c\u6837\u4e3a\u4f60\u60f3\u5230\u4e86\u8fd9\u4e2a\u95ee\u9898\uff0c\u4e5f\u63d0\u4f9b\u4e86\u89e3\u51b3\u529e\u6cd5\uff1a<\/p>\n
git log master...dev <\/pre>\n\u7ed3\u679c\uff1a<\/p>\n
[alvin@VM_0_16_centos git-log]$ git log master...dev \r\ncommit c690054c67b833b22dce4120899526743b20d36d \r\nAuthor: Liangxu \r\nDate: Sun Dec 9 07:31:47 2018 +0800 \r\n [master] \u7248\u672c7 \r\ncommit b191410906ae20a865fde3f163bb01fd6cfc1f11 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 21:03:13 2018 +0800 \r\n [dev] \u7248\u672c6 \r\ncommit 793c9582ab0a45c4f8f548be36c06bc5ca427c62 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 21:02:30 2018 +0800 \r\n [dev] \u7248\u672c5 \r\ncommit 4872f653a8fd7c8541abb4a292d628dc7625884b \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 20:58:05 2018 +0800 \r\n [dev] \u7248\u672c4 <\/pre>\n\u8bf7\u6ce8\u610f\uff0c\u5728\u8fd9\u91cc\uff0cmaster \u4e0e dev \u4e4b\u95f4\u6709\u4e09\u4e2a\u70b9\uff0c\u6709\u522b\u4e8e\u4e4b\u524d\u7684\u547d\u4ee4(\u4e24\u4e2a\u70b9)\u3002\u800c\u4e14\uff0c\u8fd9\u4e2a\u547d\u4ee4\u7684\u6267\u884c\u7ed3\u679c\u4e0e git log dev...master \u5b8c\u5168\u4e00\u6837\u3002<\/p>\n
\u6211\u4eec\u8fd9\u91cc\u662f\u4e3a\u4e86\u65b9\u4fbf\u6f14\u793a\uff0c\u52a0\u4e86 [master] \u3001 [dev] \u3001 [both] \u8fd9\u6837\u7684\u8bb0\u53f7\uff0c\u4f46\u5728\u5b9e\u9645\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u5f88\u5c11\u4f1a\u8fd9\u6837\u64cd\u4f5c\u3002\u90a3\u6211\u4eec\u5728\u6267\u884c git log master...dev \u65f6\uff0c\u600e\u4e48\u77e5\u9053\u6709\u5dee\u5f02\u7684\u63d0\u4ea4\u662f\u5728 master \u5206\u652f\u91cc\uff0c\u8fd8\u662f dev \u5206\u652f\u91cc?\u6211\u4eec\u53ea\u9700\u52a0\u4e0a --left-right \u9009\u9879\u5373\u53ef\u3002<\/p>\n
git log --left-right master...dev <\/pre>\n\u7ed3\u679c\uff1a<\/p>\n
[alvin@VM_0_16_centos git-log]$ git log --left-right master...dev \r\ncommit < c690054c67b833b22dce4120899526743b20d36d \r\nAuthor: Liangxu \r\nDate: Sun Dec 9 07:31:47 2018 +0800 \r\n [master] \u7248\u672c7 \r\ncommit > b191410906ae20a865fde3f163bb01fd6cfc1f11 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 21:03:13 2018 +0800 \r\n [dev] \u7248\u672c6 \r\ncommit > 793c9582ab0a45c4f8f548be36c06bc5ca427c62 \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 21:02:30 2018 +0800 \r\n [dev] \u7248\u672c5 \r\ncommit > 4872f653a8fd7c8541abb4a292d628dc7625884b \r\nAuthor: Liangxu \r\nDate: Sat Dec 8 20:58:05 2018 +0800 \r\n [dev] \u7248\u672c4 <\/pre>\n\u6211\u4eec\u4f1a\u53d1\u73b0\uff0c\u5728 commit \u4e0e\u54c8\u5e0c\u503c\u4e4b\u95f4\u591a\u4e86\u4e2a < \u6216 > \uff0c\u5176\u4e2d < \u8868\u793a\u53ea\u5728 master \u5206\u652f\u7684\u63d0\u4ea4\uff0c > \u8868\u793a\u53ea\u5728 dev \u5206\u652f\u7684\u63d0\u4ea4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u524d\u4e24\u5929\u5728\u505a\u96c6\u6210\u7684\u65f6\u5019\u78b0\u5230\u4e86\u4e00\u4ef6\u95f9\u5fc3\u4e8b\u3002\u4e8b\u60c5\u662f\u8fd9\u6837\u7684\uff0c\u826f\u8bb8\u7684\u4e00\u4f4d\u540c\u4e8b\u4e0d\u5c0f\u5fc3\u628a\u4e00\u4e2a\u9519\u8bef\u7684 dev \u5206\u652f merge […]<\/p>\n","protected":false},"author":317,"featured_media":95067,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-200387","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/200387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/317"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=200387"}],"version-history":[{"count":1,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/200387\/revisions"}],"predecessor-version":[{"id":200390,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/200387\/revisions\/200390"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/95067"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=200387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=200387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=200387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}