{"id":35619,"date":"2023-01-21T02:05:47","date_gmt":"2023-01-20T18:05:47","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=35619"},"modified":"2023-01-21T02:06:22","modified_gmt":"2023-01-20T18:06:22","slug":"git-branch-history-today","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/git-branch-history-today.html","title":{"rendered":"Git\u5206\u652f\u7684\u524d\u4e16\u4eca\u751f"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u51e0\u4e4e\u6240\u6709\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u90fd\u4ee5\u67d0\u79cd\u5f62\u5f0f\u652f\u6301\u5206\u652f\u3002 \u4f7f\u7528\u5206\u652f\u610f\u5473\u7740\u4f60\u53ef\u4ee5\u628a\u4f60\u7684\u5de5\u4f5c\u4ece\u5f00\u53d1\u4e3b\u7ebf\u4e0a\u5206\u79bb\u5f00\u6765\uff0c\u4ee5\u514d\u5f71\u54cd\u5f00\u53d1\u4e3b\u7ebf\u3002 \u5728\u5f88\u591a\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u4e2d\uff0c\u8fd9\u662f\u4e00\u4e2a\u7565\u5fae\u4f4e\u6548\u7684\u8fc7\u7a0b\u2014\u2014\u5e38\u5e38\u9700\u8981\u5b8c\u5168\u521b\u5efa\u4e00\u4e2a\u6e90\u4ee3\u7801\u76ee\u5f55\u7684\u526f\u672c\u3002\u5bf9\u4e8e\u5927\u9879\u76ee\u6765\u8bf4\uff0c\u8fd9\u6837\u7684\u8fc7\u7a0b\u4f1a\u8017\u8d39\u5f88\u591a\u65f6\u95f4\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

<\/h1>\n
1.1 Git \u5206\u652f - \u5206\u652f\u7b80\u4ecb<\/strong><\/div>\n

\u6709\u4eba\u628a Git \u7684\u5206\u652f\u6a21\u578b\u79f0\u4e3a\u5b83\u7684\u201c\u5fc5\u6740\u6280\u7279\u6027\u201d\uff0c\u4e5f\u6b63\u56e0\u4e3a\u8fd9\u4e00\u7279\u6027\uff0c\u4f7f\u5f97 Git \u4ece\u4f17\u591a\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u4e2d\u8131\u9896\u800c\u51fa\u3002 \u4e3a\u4f55 Git \u7684\u5206\u652f\u6a21\u578b\u5982\u6b64\u51fa\u4f17\u5462\uff1f Git \u5904\u7406\u5206\u652f\u7684\u65b9\u5f0f\u53ef\u8c13\u662f\u96be\u4ee5\u7f6e\u4fe1\u7684\u8f7b\u91cf\uff0c\u521b\u5efa\u65b0\u5206\u652f\u8fd9\u4e00\u64cd\u4f5c\u51e0\u4e4e\u80fd\u5728\u77ac\u95f4\u5b8c\u6210\uff0c\u5e76\u4e14\u5728\u4e0d\u540c\u5206\u652f\u4e4b\u95f4\u7684\u5207\u6362\u64cd\u4f5c\u4e5f\u662f\u4e00\u6837\u4fbf\u6377\u3002 \u4e0e\u8bb8\u591a\u5176\u5b83\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u4e0d\u540c\uff0cGit \u9f13\u52b1\u5728\u5de5\u4f5c\u6d41\u7a0b\u4e2d\u9891\u7e41\u5730\u4f7f\u7528\u5206\u652f\u4e0e\u5408\u5e76\uff0c\u54ea\u6015\u4e00\u5929\u4e4b\u5185\u8fdb\u884c\u8bb8\u591a\u6b21\u3002 \u7406\u89e3\u548c\u7cbe\u901a\u8fd9\u4e00\u7279\u6027\uff0c\u4f60\u4fbf\u4f1a\u610f\u8bc6\u5230 Git \u662f\u5982\u6b64\u7684\u5f3a\u5927\u800c\u53c8\u72ec\u7279\uff0c\u5e76\u4e14\u4ece\u6b64\u771f\u6b63\u6539\u53d8\u4f60\u7684\u5f00\u53d1\u65b9\u5f0f\u3002<\/p>\n

\u5206\u652f\u7b80\u4ecb<\/strong><\/span><\/div>\n

\u4e3a\u4e86\u771f\u6b63\u7406\u89e3 Git \u5904\u7406\u5206\u652f\u7684\u65b9\u5f0f\uff0c\u6211\u4eec\u9700\u8981\u56de\u987e\u4e00\u4e0b Git \u662f\u5982\u4f55\u4fdd\u5b58\u6570\u636e\u7684\u3002<\/p>\n

\u6216\u8bb8\u4f60\u8fd8\u8bb0\u5f97\u00a0\u8d77\u6b65<\/a>\u00a0\u7684\u5185\u5bb9\uff0cGit \u4fdd\u5b58\u7684\u4e0d\u662f\u6587\u4ef6\u7684\u53d8\u5316\u6216\u8005\u5dee\u5f02\uff0c\u800c\u662f\u4e00\u7cfb\u5217\u4e0d\u540c\u65f6\u523b\u7684\u6587\u4ef6\u5feb\u7167\u3002<\/p>\n

\u5728\u8fdb\u884c\u63d0\u4ea4\u64cd\u4f5c\u65f6\uff0cGit \u4f1a\u4fdd\u5b58\u4e00\u4e2a\u63d0\u4ea4\u5bf9\u8c61\uff08commit object\uff09\u3002\u77e5\u9053\u4e86 Git \u4fdd\u5b58\u6570\u636e\u7684\u65b9\u5f0f\uff0c\u6211\u4eec\u53ef\u4ee5\u5f88\u81ea\u7136\u7684\u60f3\u5230\u2014\u2014\u8be5\u63d0\u4ea4\u5bf9\u8c61\u4f1a\u5305\u542b\u4e00\u4e2a\u6307\u5411\u6682\u5b58\u5185\u5bb9\u5feb\u7167\u7684\u6307\u9488\u3002 \u4f46\u4e0d\u4ec5\u4ec5\u662f\u8fd9\u6837\uff0c\u8be5\u63d0\u4ea4\u5bf9\u8c61\u8fd8\u5305\u542b\u4e86\u4f5c\u8005\u7684\u59d3\u540d\u548c\u90ae\u7bb1\u3001\u63d0\u4ea4\u65f6\u8f93\u5165\u7684\u4fe1\u606f\u4ee5\u53ca\u6307\u5411\u5b83\u7684\u7236\u5bf9\u8c61\u7684\u6307\u9488\u3002\u9996\u6b21\u63d0\u4ea4\u4ea7\u751f\u7684\u63d0\u4ea4\u5bf9\u8c61\u6ca1\u6709\u7236\u5bf9\u8c61\uff0c\u666e\u901a\u63d0\u4ea4\u64cd\u4f5c\u4ea7\u751f\u7684\u63d0\u4ea4\u5bf9\u8c61\u6709\u4e00\u4e2a\u7236\u5bf9\u8c61\uff0c\u800c\u7531\u591a\u4e2a\u5206\u652f\u5408\u5e76\u4ea7\u751f\u7684\u63d0\u4ea4\u5bf9\u8c61\u6709\u591a\u4e2a\u7236\u5bf9\u8c61\uff0c<\/p>\n

\u4e3a\u4e86\u8bf4\u5f97\u66f4\u52a0\u5f62\u8c61\uff0c\u6211\u4eec\u5047\u8bbe\u73b0\u5728\u6709\u4e00\u4e2a\u5de5\u4f5c\u76ee\u5f55\uff0c\u91cc\u9762\u5305\u542b\u4e86\u4e09\u4e2a\u5c06\u8981\u88ab\u6682\u5b58\u548c\u63d0\u4ea4\u7684\u6587\u4ef6\u3002 \u6682\u5b58\u64cd\u4f5c\u4f1a\u4e3a\u6bcf\u4e00\u4e2a\u6587\u4ef6\u8ba1\u7b97\u6821\u9a8c\u548c\uff08\u4f7f\u7528\u6211\u4eec\u5728\u00a0\u8d77\u6b65<\/a>\u00a0\u4e2d\u63d0\u5230\u7684 SHA-1 \u54c8\u5e0c\u7b97\u6cd5\uff09\uff0c\u7136\u540e\u4f1a\u628a\u5f53\u524d\u7248\u672c\u7684\u6587\u4ef6\u5feb\u7167\u4fdd\u5b58\u5230 Git \u4ed3\u5e93\u4e2d\uff08Git \u4f7f\u7528 blob \u5bf9\u8c61\u6765\u4fdd\u5b58\u5b83\u4eec\uff09\uff0c\u6700\u7ec8\u5c06\u6821\u9a8c\u548c\u52a0\u5165\u5230\u6682\u5b58\u533a\u57df\u7b49\u5f85\u63d0\u4ea4\uff1a<\/p>\n

$ git add README test.rb LICENSE\r\n$ git commit -m 'The initial commit of my project'<\/pre>\n

\u5f53\u4f7f\u7528\u00a0git commit\u00a0\u8fdb\u884c\u63d0\u4ea4\u64cd\u4f5c\u65f6\uff0cGit \u4f1a\u5148\u8ba1\u7b97\u6bcf\u4e00\u4e2a\u5b50\u76ee\u5f55\uff08\u672c\u4f8b\u4e2d\u53ea\u6709\u9879\u76ee\u6839\u76ee\u5f55\uff09\u7684\u6821\u9a8c\u548c\uff0c\u7136\u540e\u5728 Git \u4ed3\u5e93\u4e2d\u8fd9\u4e9b\u6821\u9a8c\u548c\u4fdd\u5b58\u4e3a\u6811\u5bf9\u8c61\u3002 \u968f\u540e\uff0cGit \u4fbf\u4f1a\u521b\u5efa\u4e00\u4e2a\u63d0\u4ea4\u5bf9\u8c61\uff0c\u5b83\u9664\u4e86\u5305\u542b\u4e0a\u9762\u63d0\u5230\u7684\u90a3\u4e9b\u4fe1\u606f\u5916\uff0c\u8fd8\u5305\u542b\u6307\u5411\u8fd9\u4e2a\u6811\u5bf9\u8c61\uff08\u9879\u76ee\u6839\u76ee\u5f55\uff09\u7684\u6307\u9488\u3002\u5982\u6b64\u4e00\u6765\uff0cGit \u5c31\u53ef\u4ee5\u5728\u9700\u8981\u7684\u65f6\u5019\u91cd\u73b0\u6b64\u6b21\u4fdd\u5b58\u7684\u5feb\u7167\u3002<\/a><\/p>\n

\u73b0\u5728\uff0cGit \u4ed3\u5e93\u4e2d\u6709\u4e94\u4e2a\u5bf9\u8c61\uff1a\u4e09\u4e2a blob \u5bf9\u8c61\uff08\u4fdd\u5b58\u7740\u6587\u4ef6\u5feb\u7167\uff09\u3001\u4e00\u4e2a\u6811\u5bf9\u8c61\uff08\u8bb0\u5f55\u7740\u76ee\u5f55\u7ed3\u6784\u548c blob \u5bf9\u8c61\u7d22\u5f15\uff09\u4ee5\u53ca\u4e00\u4e2a\u63d0\u4ea4\u5bf9\u8c61\uff08\u5305\u542b\u7740\u6307\u5411\u524d\u8ff0\u6811\u5bf9\u8c61\u7684\u6307\u9488\u548c\u6240\u6709\u63d0\u4ea4\u4fe1\u606f\uff09\u3002<\/p>\n

\"\u9996\u6b21\u63d0\u4ea4\u5bf9\u8c61\u53ca\u5176\u6811\u7ed3\u6784.\"<\/p>\n

Figure 3-1.\u00a0\u9996\u6b21\u63d0\u4ea4\u5bf9\u8c61\u53ca\u5176\u6811\u7ed3\u6784\u505a\u4e9b\u4fee\u6539\u540e\u518d\u6b21\u63d0\u4ea4\uff0c\u90a3\u4e48\u8fd9\u6b21\u4ea7\u751f\u7684\u63d0\u4ea4\u5bf9\u8c61\u4f1a\u5305\u542b\u4e00\u4e2a\u6307\u5411\u4e0a\u6b21\u63d0\u4ea4\u5bf9\u8c61\uff08\u7236\u5bf9\u8c61\uff09\u7684\u6307\u9488\u3002<\/p>\n

\"\u63d0\u4ea4\u5bf9\u8c61\u53ca\u5176\u7236\u5bf9\u8c61.\"<\/p>\n

Figure 3-2.\u00a0\u63d0\u4ea4\u5bf9\u8c61\u53ca\u5176\u7236\u5bf9\u8c61Git \u7684\u5206\u652f\uff0c\u5176\u5b9e\u672c\u8d28\u4e0a\u4ec5\u4ec5\u662f\u6307\u5411\u63d0\u4ea4\u5bf9\u8c61\u7684\u53ef\u53d8\u6307\u9488\u3002 Git \u7684\u9ed8\u8ba4\u5206\u652f\u540d\u5b57\u662f\u00a0master\u3002 \u5728\u591a\u6b21\u63d0\u4ea4\u64cd\u4f5c\u4e4b\u540e\uff0c\u4f60\u5176\u5b9e\u5df2\u7ecf\u6709\u4e00\u4e2a\u6307\u5411\u6700\u540e\u90a3\u4e2a\u63d0\u4ea4\u5bf9\u8c61\u7684\u00a0master\u00a0\u5206\u652f\u3002 \u5b83\u4f1a\u5728\u6bcf\u6b21\u7684\u63d0\u4ea4\u64cd\u4f5c\u4e2d\u81ea\u52a8\u5411\u524d\u79fb\u52a8\u3002<\/p>\n

NOTE<\/strong><\/span><\/div>\n

Git \u7684 \u201cmaster\u201d \u5206\u652f\u5e76\u4e0d\u662f\u4e00\u4e2a\u7279\u6b8a\u5206\u652f\u3002<\/a>\u00a0\u5b83\u5c31\u8ddf\u5176\u5b83\u5206\u652f\u5b8c\u5168\u6ca1\u6709\u533a\u522b\u3002 \u4e4b\u6240\u4ee5\u51e0\u4e4e\u6bcf\u4e00\u4e2a\u4ed3\u5e93\u90fd\u6709 master \u5206\u652f\uff0c\u662f\u56e0\u4e3a\u00a0git init\u00a0\u547d\u4ee4\u9ed8\u8ba4\u521b\u5efa\u5b83\uff0c\u5e76\u4e14\u5927\u591a\u6570\u4eba\u90fd\u61d2\u5f97\u53bb\u6539\u52a8\u5b83\u3002<\/p>\n

\"\u5206\u652f\u53ca\u5176\u63d0\u4ea4\u5386\u53f2.\"<\/p>\n

Figure 3-3.\u00a0\u5206\u652f\u53ca\u5176\u63d0\u4ea4\u5386\u53f2<\/p>\n

\u5206\u652f\u521b\u5efa<\/strong><\/span><\/div>\n

<\/a>Git \u662f\u600e\u4e48\u521b\u5efa\u65b0\u5206\u652f\u7684\u5462\uff1f \u5f88\u7b80\u5355\uff0c\u5b83\u53ea\u662f\u4e3a\u4f60\u521b\u5efa\u4e86\u4e00\u4e2a\u53ef\u4ee5\u79fb\u52a8\u7684\u65b0\u7684\u6307\u9488\u3002 \u6bd4\u5982\uff0c\u521b\u5efa\u4e00\u4e2a testing \u5206\u652f\uff0c \u4f60\u9700\u8981\u4f7f\u7528\u00a0git branch\u00a0\u547d\u4ee4\uff1a<\/a><\/p>\n

git branch testing<\/pre>\n

\u8fd9\u4f1a\u5728\u5f53\u524d\u6240\u5728\u7684\u63d0\u4ea4\u5bf9\u8c61\u4e0a\u521b\u5efa\u4e00\u4e2a\u6307\u9488\u3002<\/p>\n

\"\u4e24\u4e2a\u6307\u5411\u76f8\u540c\u63d0\u4ea4\u5386\u53f2\u7684\u5206\u652f\u3002\"<\/p>\n

Figure 3-4.\u00a0\u4e24\u4e2a\u6307\u5411\u76f8\u540c\u63d0\u4ea4\u5386\u53f2\u7684\u5206\u652f\u90a3\u4e48\uff0cGit \u53c8\u662f\u600e\u4e48\u77e5\u9053\u5f53\u524d\u5728\u54ea\u4e00\u4e2a\u5206\u652f\u4e0a\u5462\uff1f \u4e5f\u5f88\u7b80\u5355\uff0c\u5b83\u6709\u4e00\u4e2a\u540d\u4e3a\u00a0HEAD\u00a0\u7684\u7279\u6b8a\u6307\u9488\u3002 \u8bf7\u6ce8\u610f\u5b83\u548c\u8bb8\u591a\u5176\u5b83\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff08\u5982 Subversion \u6216 CVS\uff09\u91cc\u7684HEAD\u6982\u5ff5\u5b8c\u5168\u4e0d\u540c\u3002 \u5728 Git \u4e2d\uff0c\u5b83\u662f\u4e00\u4e2a\u6307\u9488\uff0c\u6307\u5411\u5f53\u524d\u6240\u5728\u7684\u672c\u5730\u5206\u652f\uff08\u8bd1\u6ce8\uff1a\u5c06\u00a0HEAD\u00a0\u60f3\u8c61\u4e3a\u5f53\u524d\u5206\u652f\u7684\u522b\u540d\uff09\u3002 \u5728\u672c\u4f8b\u4e2d\uff0c\u4f60\u4ecd\u7136\u5728master\u00a0\u5206\u652f\u4e0a\u3002 \u56e0\u4e3a\u00a0git branch\u00a0\u547d\u4ee4\u4ec5\u4ec5\u00a0\u521b\u5efa<\/em>\u00a0\u4e00\u4e2a\u65b0\u5206\u652f\uff0c\u5e76\u4e0d\u4f1a\u81ea\u52a8\u5207\u6362\u5230\u65b0\u5206\u652f\u4e2d\u53bb\u3002<\/p>\n

\"HEAD<\/p>\n

Figure 3-5.\u00a0HEAD \u6307\u5411\u5f53\u524d\u6240\u5728\u7684\u5206\u652f\u4f60\u53ef\u4ee5\u7b80\u5355\u5730\u4f7f\u7528git log\u00a0\u547d\u4ee4\u67e5\u770b\u5404\u4e2a\u5206\u652f\u5f53\u524d\u6240\u6307\u7684\u5bf9\u8c61\u3002 \u63d0\u4f9b\u8fd9\u4e00\u529f\u80fd\u7684\u53c2\u6570\u662f\u00a0--decorate\u3002<\/p>\n

 git log --oneline --decorate\r\nf30ab (HEAD, master, testing) add feature #32 - ability to add new\r\n34ac2 fixed bug #1328 - stack overflow under certain conditions\r\n98ca9 initial commit of my project<\/pre>\n

\u6b63\u5982\u4f60\u6240\u89c1\uff0c\u5f53\u524d \u201cmaster\u201d \u548c \u201ctesting\u201d \u5206\u652f\u5747\u6307\u5411\u6821\u9a8c\u548c\u4ee5\u00a0f30ab\u00a0\u5f00\u5934\u7684\u63d0\u4ea4\u5bf9\u8c61\u3002<\/p>\n

\u5206\u652f\u5207\u6362<\/strong><\/span><\/div>\n

<\/a>\u8981\u5207\u6362\u5230\u4e00\u4e2a\u5df2\u5b58\u5728\u7684\u5206\u652f\uff0c\u4f60\u9700\u8981\u4f7f\u7528\u00a0git checkout\u00a0\u547d\u4ee4\u3002<\/a>\u00a0\u6211\u4eec\u73b0\u5728\u5207\u6362\u5230\u65b0\u521b\u5efa\u7684\u00a0testing\u00a0\u5206\u652f\u53bb\uff1a<\/p>\n

 git checkout testing<\/pre>\n

\u8fd9\u6837\u00a0HEAD\u00a0\u5c31\u6307\u5411\u00a0testing\u00a0\u5206\u652f\u4e86\u3002<\/p>\n

\"HEAD<\/p>\n

Figure 3-6.\u00a0HEAD \u6307\u5411\u5f53\u524d\u6240\u5728\u7684\u5206\u652f\u90a3\u4e48\uff0c\u8fd9\u6837\u7684\u5b9e\u73b0\u65b9\u5f0f\u4f1a\u7ed9\u6211\u4eec\u5e26\u6765\u4ec0\u4e48\u597d\u5904\u5462\uff1f \u73b0\u5728\u4e0d\u59a8\u518d\u63d0\u4ea4\u4e00\u6b21\uff1a<\/p>\n

vim test.rb\r\ngit commit -a -m 'made a change'<\/pre>\n

\"HEAD<\/p>\n

Figure 3-7.\u00a0HEAD \u5206\u652f\u968f\u7740\u63d0\u4ea4\u64cd\u4f5c\u81ea\u52a8\u5411\u524d\u79fb\u52a8\u5982\u56fe\u6240\u793a\uff0c\u4f60\u7684testing\u5206\u652f\u5411\u524d\u79fb\u52a8\u4e86\uff0c\u4f46\u662f\u00a0master\u00a0\u5206\u652f\u5374\u6ca1\u6709\uff0c\u5b83\u4ecd\u7136\u6307\u5411\u8fd0\u884c\u00a0git checkout\u00a0\u65f6\u6240\u6307\u7684\u5bf9\u8c61\u3002 \u8fd9\u5c31\u6709\u610f\u601d\u4e86\uff0c\u73b0\u5728\u6211\u4eec\u5207\u6362\u56de\u00a0master\u00a0\u5206\u652f\u770b\u770b\uff1a<\/p>\n

git checkout master<\/pre>\n

\"\u68c0\u51fa\u65f6<\/p>\n

Figure 3-8.\u00a0\u68c0\u51fa\u65f6 HEAD \u968f\u4e4b\u79fb\u52a8\u8fd9\u6761\u547d\u4ee4\u505a\u4e86\u4e24\u4ef6\u4e8b\u3002 \u4e00\u662f\u4f7f HEAD \u6307\u56de\u00a0master\u00a0\u5206\u652f\uff0c\u4e8c\u662f\u5c06\u5de5\u4f5c\u76ee\u5f55\u6062\u590d\u6210\u00a0master\u00a0\u5206\u652f\u6240\u6307\u5411\u7684\u5feb\u7167\u5185\u5bb9\u3002 \u4e5f\u5c31\u662f\u8bf4\uff0c\u4f60\u73b0\u5728\u505a\u4fee\u6539\u7684\u8bdd\uff0c\u9879\u76ee\u5c06\u59cb\u4e8e\u4e00\u4e2a\u8f83\u65e7\u7684\u7248\u672c\u3002 \u672c\u8d28\u4e0a\u6765\u8bb2\uff0c\u8fd9\u5c31\u662f\u5ffd\u7565testing\u00a0\u5206\u652f\u6240\u505a\u7684\u4fee\u6539\uff0c\u4ee5\u4fbf\u4e8e\u5411\u53e6\u4e00\u4e2a\u65b9\u5411\u8fdb\u884c\u5f00\u53d1\u3002<\/p>\n

\u5206\u652f\u5207\u6362\u4f1a\u6539\u53d8\u4f60\u5de5\u4f5c\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6<\/strong><\/div>\n

\u5728\u5207\u6362\u5206\u652f\u65f6\uff0c\u4e00\u5b9a\u8981\u6ce8\u610f\u4f60\u5de5\u4f5c\u76ee\u5f55\u91cc\u7684\u6587\u4ef6\u4f1a\u88ab\u6539\u53d8\u3002 \u5982\u679c\u662f\u5207\u6362\u5230\u4e00\u4e2a\u8f83\u65e7\u7684\u5206\u652f\uff0c\u4f60\u7684\u5de5\u4f5c\u76ee\u5f55\u4f1a\u6062\u590d\u5230\u8be5\u5206\u652f\u6700\u540e\u4e00\u6b21\u63d0\u4ea4\u65f6\u7684\u6837\u5b50\u3002 \u5982\u679c Git \u4e0d\u80fd\u5e72\u51c0\u5229\u843d\u5730\u5b8c\u6210\u8fd9\u4e2a\u4efb\u52a1\uff0c\u5b83\u5c06\u7981\u6b62\u5207\u6362\u5206\u652f\u3002<\/p>\n

\u6211\u4eec\u4e0d\u59a8\u518d\u7a0d\u5fae\u505a\u4e9b\u4fee\u6539\u5e76\u63d0\u4ea4\uff1a<\/p>\n

$ vim test.rb\r\n$ git commit -a -m 'made other changes'<\/pre>\n

\u73b0\u5728\uff0c\u8fd9\u4e2a\u9879\u76ee\u7684\u63d0\u4ea4\u5386\u53f2\u5df2\u7ecf\u4ea7\u751f\u4e86\u5206\u53c9\uff08\u53c2\u89c1\u00a0Figure\u00a03-9<\/a>\uff09\u3002 \u56e0\u4e3a\u521a\u624d\u4f60\u521b\u5efa\u4e86\u4e00\u4e2a\u65b0\u5206\u652f\uff0c\u5e76\u5207\u6362\u8fc7\u53bb\u8fdb\u884c\u4e86\u4e00\u4e9b\u5de5\u4f5c\uff0c\u968f\u540e\u53c8\u5207\u6362\u56de master \u5206\u652f\u8fdb\u884c\u4e86\u53e6\u5916\u4e00\u4e9b\u5de5\u4f5c\u3002 \u4e0a\u8ff0\u4e24\u6b21\u6539\u52a8\u9488\u5bf9\u7684\u662f\u4e0d\u540c\u5206\u652f\uff1a\u4f60\u53ef\u4ee5\u5728\u4e0d\u540c\u5206\u652f\u95f4\u4e0d\u65ad\u5730\u6765\u56de\u5207\u6362\u548c\u5de5\u4f5c\uff0c\u5e76\u5728\u65f6\u673a\u6210\u719f\u65f6\u5c06\u5b83\u4eec\u5408\u5e76\u8d77\u6765\u3002 \u800c\u6240\u6709\u8fd9\u4e9b\u5de5\u4f5c\uff0c\u4f60\u9700\u8981\u7684\u547d\u4ee4\u53ea\u6709\u00a0branch\u3001checkout\u00a0\u548c\u00a0commit\u3002<\/p>\n

\"\u9879\u76ee\u5206\u53c9\u5386\u53f2.\"<\/p>\n

Figure 3-9.\u00a0\u9879\u76ee\u5206\u53c9\u5386\u53f2\u4f60\u53ef\u4ee5\u7b80\u5355\u5730\u4f7f\u7528\u00a0git log\u00a0\u547d\u4ee4\u67e5\u770b\u5206\u53c9\u5386\u53f2\u3002 \u8fd0\u884c\u00a0git log --oneline --decorate --graph --all\u00a0\uff0c\u5b83\u4f1a\u8f93\u51fa\u4f60\u7684\u63d0\u4ea4\u5386\u53f2\u3001\u5404\u4e2a\u5206\u652f\u7684\u6307\u5411\u4ee5\u53ca\u9879\u76ee\u7684\u5206\u652f\u5206\u53c9\u60c5\u51b5\u3002<\/p>\n

$ git log --oneline --decorate --graph --all\r\n* c2b9e (HEAD, master) made other changes\r\n| * 87ab2 (testing) made a change\r\n|\/\r\n* f30ab add feature #32 - ability to add new formats to the\r\n* 34ac2 fixed bug #1328 - stack overflow under certain conditions\r\n* 98ca9 initial commit of my project<\/pre>\n

\u7531\u4e8e Git \u7684\u5206\u652f\u5b9e\u8d28\u4e0a\u4ec5\u662f\u5305\u542b\u6240\u6307\u5bf9\u8c61\u6821\u9a8c\u548c\uff08\u957f\u5ea6\u4e3a 40 \u7684 SHA-1 \u503c\u5b57\u7b26\u4e32\uff09\u7684\u6587\u4ef6\uff0c\u6240\u4ee5\u5b83\u7684\u521b\u5efa\u548c\u9500\u6bc1\u90fd\u5f02\u5e38\u9ad8\u6548\u3002 \u521b\u5efa\u4e00\u4e2a\u65b0\u5206\u652f\u5c31\u50cf\u662f\u5f80\u4e00\u4e2a\u6587\u4ef6\u4e2d\u5199\u5165 41 \u4e2a\u5b57\u8282\uff0840 \u4e2a\u5b57\u7b26\u548c 1 \u4e2a\u6362\u884c\u7b26\uff09\uff0c\u5982\u6b64\u7684\u7b80\u5355\u80fd\u4e0d\u5feb\u5417\uff1f<\/p>\n

\u8fd9\u4e0e\u8fc7\u53bb\u5927\u591a\u6570\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u5f62\u6210\u4e86\u9c9c\u660e\u7684\u5bf9\u6bd4\uff0c\u5b83\u4eec\u5728\u521b\u5efa\u5206\u652f\u65f6\uff0c\u5c06\u6240\u6709\u7684\u9879\u76ee\u6587\u4ef6\u90fd\u590d\u5236\u4e00\u904d\uff0c\u5e76\u4fdd\u5b58\u5230\u4e00\u4e2a\u7279\u5b9a\u7684\u76ee\u5f55\u3002 \u5b8c\u6210\u8fd9\u6837\u7e41\u7410\u7684\u8fc7\u7a0b\u901a\u5e38\u9700\u8981\u597d\u51e0\u79d2\u949f\uff0c\u6709\u65f6\u751a\u81f3\u9700\u8981\u597d\u51e0\u5206\u949f\u3002\u6240\u9700\u65f6\u95f4\u7684\u957f\u77ed\uff0c\u5b8c\u5168\u53d6\u51b3\u4e8e\u9879\u76ee\u7684\u89c4\u6a21\u3002\u800c\u5728 Git \u4e2d\uff0c\u4efb\u4f55\u89c4\u6a21\u7684\u9879\u76ee\u90fd\u80fd\u5728\u77ac\u95f4\u521b\u5efa\u65b0\u5206\u652f\u3002 \u540c\u65f6\uff0c\u7531\u4e8e\u6bcf\u6b21\u63d0\u4ea4\u90fd\u4f1a\u8bb0\u5f55\u7236\u5bf9\u8c61\uff0c\u6240\u4ee5\u5bfb\u627e\u6070\u5f53\u7684\u5408\u5e76\u57fa\u7840\uff08\u8bd1\u6ce8\uff1a\u5373\u5171\u540c\u7956\u5148\uff09\u4e5f\u662f\u540c\u6837\u7684\u7b80\u5355\u548c\u9ad8\u6548\u3002 \u8fd9\u4e9b\u9ad8\u6548\u7684\u7279\u6027\u4f7f\u5f97 Git \u9f13\u52b1\u5f00\u53d1\u4eba\u5458\u9891\u7e41\u5730\u521b\u5efa\u548c\u4f7f\u7528\u5206\u652f\u3002<\/p>\n

\u63a5\u4e0b\u6765\uff0c\u8ba9\u6211\u4eec\u770b\u770b\u4e3a\u4ec0\u4e48\u4f60\u5e94\u8be5\u8fd9\u4e48\u505a\uff1f<\/p>\n

Git \u5206\u652f - \u5206\u652f\u7684\u65b0\u5efa\u4e0e\u5408\u5e76<\/strong><\/div>\n
\u5206\u652f\u7684\u65b0\u5efa\u4e0e\u5408\u5e76<\/strong><\/span><\/div>\n

\u8ba9\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u7b80\u5355\u7684\u5206\u652f\u65b0\u5efa\u4e0e\u5206\u652f\u5408\u5e76\u7684\u4f8b\u5b50\uff0c\u5b9e\u9645\u5de5\u4f5c\u4e2d\u4f60\u53ef\u80fd\u4f1a\u7528\u5230\u7c7b\u4f3c\u7684\u5de5\u4f5c\u6d41\u3002 \u4f60\u5c06\u7ecf\u5386\u5982\u4e0b\u6b65\u9aa4\uff1a<\/p>\n