{"id":37442,"date":"2023-12-28T07:46:16","date_gmt":"2023-03-17T12:26:11","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/"},"modified":"2024-05-04T15:43:06","modified_gmt":"2024-05-04T07:43:06","slug":"%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/","title":{"rendered":"\u6211\u5bf9Git\u4e00\u65e0\u6240\u77e5"},"content":{"rendered":"<h2>\u9996\u5148<\/h2>\n<p>\u6211\u4e0d\u61c2Git\u3002<br \/>\n\u4e3a\u4ec0\u4e48\u641e\u4e0d\u61c2\u5462\uff1f<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\u53ef\u80fd\u4e3a\uff1a\u901a\u8fc7\u67e5\u770b.git\/\u76ee\u5f55\uff0c\u53ef\u4ee5\u5c06\u5176\u89c6\u4e3a\u6587\u4ef6\u66f4\u6539\uff0c\u4ece\u800c\u786e\u8ba4\u5176\u52a8\u4f5c\u5e76\u7406\u89e3\u5176\u673a\u5236\u3002<\/p>\n<h3>\u8bd5\u8fc7\u4e4b\u540e\u624d\u660e\u767d\u7684\u4e8b\u60c5\u603b\u7ed3<\/h3>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">branch\u3068\u3044\u3046\u306e\u306f\u3001\u8a00\u8449\u304b\u3089\u60f3\u50cf\u3057\u3066\u3044\u305f\u7dda\u5f62\u306e\u3082\u306e\u3067\u306f\u306a\u304f\u3001\u7279\u5b9a\u306ecommit\u3092\u6307\u3059\u70b9\u3060\u3063\u305f\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30d5\u30a1\u30a4\u30eb\u3092\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3057\u305f\u6642\u70b9\u3067.git\/object\/\u5185\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u304c\u53d6\u3089\u308c\u3066\u3044\u305f\u3002(\u306a\u306e\u3067\u3053\u307e\u3081\u306badd\u3059\u308b\u3068\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u5bb9\u91cf\u304c\u5897\u3048\u3066\u3057\u307e\u3046\u3002)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">commit\u306f\u5dee\u5206\u3067\u306f\u306a\u304f\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u3068\u8a00\u308f\u308c\u3066\u3044\u308b\u610f\u5473\u304c\u308f\u304b\u3063\u305f<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u81f3\u308b\u3068\u3053\u308d\u3067\u73fe\u308c\u308b\u30cf\u30c3\u30b7\u30e5\u306e\u4f7f\u3044\u9053\u304c\u308f\u304b\u3063\u305f\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">stash\u306fcommit\u3060\u3063\u305f<\/ul>\n<\/li>\n<\/ul>\n<p>commit -ammed\u306f\u4e0a\u66f8\u304d\u3058\u3083\u306a\u304b\u3063\u305f<br \/>\nreset\u306f\u8a00\u8449\u304b\u3089\u60f3\u50cf\u3059\u308b\u3044\u308f\u3086\u308b\u30ea\u30bb\u30c3\u30c8\u3067\u306f\u306a\u304f\u7279\u5b9a\u30b3\u30df\u30c3\u30c8\u3078\u306e\u5207\u308a\u66ff\u3048\u304c\u30e1\u30a4\u30f3\u3067\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3068\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u3092\u30ea\u30bb\u30c3\u30c8\u3059\u308b\u306e\u306f\u304a\u307e\u3051<br \/>\n\u306a\u305c\u7a7a\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u8a18\u9332\u3067\u304d\u306a\u3044\u306e\u304b\u308f\u304b\u3063\u305f(\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306fgit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u306f\u306a\u304f\u3001index\u3067\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3067\u3057\u304b\u306a\u3044\u305f\u3081)<\/p>\n<p>\u4ee5\u4e0b\u662f\u5bf9\u300c\u306a\u3069\u300d\u7684\u4e2d\u6587\u672c\u5730\u5316\u89e3\u91ca\uff1a<\/p>\n<p>\u7b49\u7b49\u3001\u8bf8\u5982\u6b64\u7c7b\u3001\u7b49\u7b49\u7b49\u7b49\u3001\u7b49\u7b49\u4e4b\u7c7b\u3002<\/p>\n<h3>\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\u6240\u6db5\u76d6\u7684\u8303\u56f4<\/h3>\n<p>\u6211\u53ea\u9700\u8981\u7528\u4e2d\u6587\u7ed9\u51fa\u4e00\u4e2a\u9009\u9879\uff1a<br \/>\n\u8fd9\u662f\u5728GitHub\u524d\u63d0\u4e0b\u5199\u7684\u3002<br \/>\n\u56e0\u4e3a\u76ee\u6807\u662f\u8ba9\u5b83\u5c3d\u5feb\u53ef\u7528\uff0c\u6240\u4ee5\u4e0d\u6d89\u53cagit gc\u7684\u64cd\u4f5c\u3002<br \/>\n\u4e0d\u6d89\u53capull\u547d\u4ee4\u4e2d\u7684fetch\u548cmerge\uff0c\u4e5f\u4e0d\u6d89\u53cacheckout\u547d\u4ee4\u4e2d\u7684switch\u548crestore\u3002<\/p>\n<h2>1. &#8220;.git\/&#8221; \u662f\u4ec0\u4e48\u610f\u601d\uff1f<\/h2>\n<p>\u5f53\u60a8\u4f7f\u7528git clone\u4eceGitHub\u7b49\u8fdc\u7a0b\u5b58\u50a8\u5e93\u4e2d\u514b\u9686\u6216\u8005\u4f7f\u7528git init\u5728\u672c\u5730\u521b\u5efa\u672c\u5730\u5b58\u50a8\u5e93\u65f6\uff0c\u4f1a\u51fa\u73b0\u8fd9\u4e9b\u60c5\u51b5\u3002<\/p>\n<h3>1-1. .git\/ \u7684\u5185\u5bb9<br \/>\nIn Chinese: .git\/\u6587\u4ef6\u5939\u5185\u7684\u5185\u5bb9<\/h3>\n<p>\u7531\u4e8e\u5728\u5c55\u793a\u6574\u4f53\u5f62\u8c61\uff0c\u56e0\u6b64\u8fd8\u4f1a\u6709\u4e00\u4e9b\u672a\u89e3\u91ca\u7684\u8bcd\u8bed\uff0c\u5b83\u4eec\u5c06\u5728\u540e\u9762\u51fa\u73b0\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u4e00\u90e8\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u30d0\u30a4\u30ca\u30ea\u30d5\u30a1\u30a4\u30eb\u306a\u306e\u3067\u3001\u30a8\u30c7\u30a3\u30bf\u3067\u305d\u306e\u307e\u307e\u958b\u3044\u3066\u3082\u4e2d\u8eab\u304c\u898b\u3089\u308c\u307e\u305b\u3093<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u72b6\u614b\u306b\u3088\u3063\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u3084\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u3042\u3063\u305f\u308a\u306a\u304b\u3063\u305f\u308a\u3057\u307e\u3059<\/ul>\n<h4>\u6587\u4ef6\u7ed3\u6784<\/h4>\n<pre class=\"post-pre\"><code> .git\/\r\n  \u251c hooks\/\u3000\r\n  \u2502  \u251c applypatch-msg.sample  \r\n  \u2502  \u251c commit-msg.sample\r\n  \u2502  \u251c fsmonitor-watchman.sample\r\n  \u2502  \u251c post-update.sample\r\n  \u2502  \u251c pre-applypatch.sample\r\n  \u2502  \u251c pre-commit.sample\r\n  \u2502  \u251c pre-merge-commit.sample\r\n  \u2502  \u251c prepare-commit-msg.sample\r\n  \u2502  \u251c pre-push.sample\r\n  \u2502  \u251c pre-rebase.sample\r\n  \u2502  \u251c pre-receive.sample\r\n  \u2502  \u251c push-to-checkout.sample\r\n  \u2502  \u2514 update.sample\r\n  \u251c info\/\r\n  \u2502  \u251c exclude\u3000\r\n  \u2502  \u2514 attributes  \r\n  \u251c logs\/\r\n  \u2502\u3000\u251c refs\/\r\n  \u2502\u3000\u2502\u3000\u251c heads\/\r\n  \u2502\u3000\u2502\u3000\u2502  \u2514 \u30d6\u30e9\u30f3\u30c1\u540d\r\n  \u2502\u3000\u2502\u3000\u251c remotes\/\r\n  \u2502\u3000\u2502\u3000\u2502  \u2514 \u30ea\u30e2\u30fc\u30c8\u540d\/\r\n  \u2502\u3000\u2502\u3000\u2502     \u2514 HEAD\r\n  \u2502\u3000\u2502\u3000\u251c stash\r\n  \u2502\u3000\u2502\u3000\u2514 tags\/\r\n  \u2502\u3000\u2502     \u2514 \u30bf\u30b0\u540d\r\n  \u2502\u3000\u2514 HEAD\r\n  \u251c  lost-found\/\r\n  \u2502   \u251c commit\/\r\n  \u2502   \u2514 other\/\r\n  \u251c objects\/\r\n  \u2502  \u251c info\/\r\n  \u2502  \u2502  \u251c commit-graph\r\n  \u2502  \u2502  \u2514 packs\r\n  \u2502  \u2514 pack\/ \r\n  \u2502     \u251c pack-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.idx\r\n  \u2502     \u2514 pack-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.pack\r\n  \u251c refs\/\r\n  \u2502  \u251c heads\/\r\n  \u2502  \u2502  \u2514 \u30d6\u30e9\u30f3\u30c1\u540d\r\n  \u2502  \u251c remotes\/\r\n  \u2502  \u2502  \u2514 \u30ea\u30e2\u30fc\u30c8\u540d\/\r\n  \u2502  \u2502      \u2514 HEAD\r\n  \u2502  \u251c tags\/\r\n  \u2502  \u2514 stash\r\n  \u251c AUTO_MERGE\r\n  \u251c CHERRY_PICK_HEAD\r\n  \u251c COMMIT_EDITMSG\r\n  \u251c config\r\n  \u251c description\r\n  \u251c FETCH_HEAD\r\n  \u251c HEAD\r\n  \u251c index\r\n  \u251c MERGE_HEAD\r\n  \u251c MERGE_MODE\r\n  \u251c MERGE_MSG\r\n  \u251c ORIG_HEAD\r\n  \u251c packed-refs\r\n  \u2514 REBASE_HEAD\r\n<\/code><\/pre>\n<h5>.git\/hooks\/ can be paraphrased as &#8220;.git\/hooks\/\u94a9\u5b50&#8221; in Chinese.<\/h5>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u4e0d\u4f1a\u6d89\u53cahooks\u768413\u4e2a\u793a\u4f8b\u6587\u4ef6\uff0c\u8fd9\u4e9b\u793a\u4f8b\u6587\u4ef6\u662f\u4f5c\u4e3a\u6302\u94a9\u811a\u672c\u6765\u8fd0\u884c\u7684\uff0c\u53ea\u8981\u53bb\u6389\u672b\u5c3e\u7684.sample\u5373\u53ef\u3002<\/p>\n<h5>.git\/info\/exclude -&gt; .git\/info\/exclude<\/h5>\n<p>\u8fd9\u7c7b\u4f3c\u4e8e\u81ea\u5df1\u4e13\u7528\u7684.gitignore\u3002<br \/>\n\u4e0e.gitignore\u4e00\u6837\uff0c\u5c06\u88ab\u6392\u9664\u5728Git\u7684\u7ba1\u7406\u4e4b\u5916\u3002<br \/>\n\u4e0d\u4f1a\u5f71\u54cd\u5176\u4ed6\u4ed3\u5e93\uff08\u4f8b\u5982\u8fdc\u7a0b\u4ed3\u5e93\u6216\u4ed6\u4eba\u7684\u672c\u5730\u4ed3\u5e93\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code># git ls-files --others --exclude-from=.git\/info\/exclude\r\n# Lines that start with '#' are comments.\r\n# For a project mostly in C, the following would be a good set of\r\n# exclude patterns (uncomment them if you want to use them):\r\n# *.[oa]\r\n# *~\r\n<\/code><\/pre>\n<h5>.git\/info\/attributes &#8211; \u4ec5\u4f9b\u53c2\u8003\u7684\u9009\u9879<\/h5>\n<h5>.git\/logs\/refs\/heads\/\u5206\u652f\u540d\u79f0<\/h5>\n<p>\u63d0\u4ea4\u7684\u8bb0\u5f55\u5c06\u4f1a\u6309\u7167\u4e0b\u65b9\u9010\u6e10\u6dfb\u52a0\u3002<\/p>\n<pre class=\"post-pre\"><code>0000000000000000000000000000000000000000 commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; UNIX\u6642\u9593 +0900\tbranch: Created from HEAD\r\n<\/code><\/pre>\n<h5>.git\/logs\/refs\/remotes\/\u30ea\u30e2\u30fc\u30c8\u540d\/HEAD \u53ef\u4ee5\u88ab\u8f6c\u8ff0\u4e3a\uff1a.git\/\u65e5\u5fd7\/\u53c2\u7167\/\u8fdc\u7a0b\/\u30ea\u30e2\u30fc\u30c8\u540d\/\u4e3b\u5206\u652f<\/h5>\n<pre class=\"post-pre\"><code>ref: refs\/remotes\/origin\/\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<h5>.git\/logs\/refs\/stash \u7684\u610f\u601d\u662f\u201c\u5b58\u50a8\u6682\u5b58\u4fe1\u606f\u7684\u65e5\u5fd7\u8def\u5f84\u201d\u3002<\/h5>\n<h5>.git\/logs\/refs\/tags\/\u6807\u7b7e\u540d\u79f0<\/h5>\n<h5>.git\/logs\/HEAD \u76ee\u5f55<\/h5>\n<p>\u672c\u5730\u7684HEAD\u79fb\u52a8\u5386\u53f2\u5c06\u88ab\u9010\u6e10\u8ffd\u52a0\u8bb0\u5f55\u3002<\/p>\n<pre class=\"post-pre\"><code>commit\u306e\u30cf\u30c3\u30b7\u30e51(40\u6841) commit\u306e\u30cf\u30c3\u30b7\u30e52(40\u6841) \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; UNIX\u6642\u9593 +0900\tclone: from github.com:\u30e6\u30fc\u30b6\u30fc\u540d\/\u30ea\u30dd\u30b8\u30c8\u30ea\u540d.git\r\n<\/code><\/pre>\n<h5>.git\/lost-found\/commit\/ \u53ef\u5c06\u5176\u539f\u751f\u7ffb\u8bd1\u4e3a\uff1a<\/h5>\n<p>. git \/ lost-found \/ commit \/<\/p>\n<h5>.git\/lost-found\/other\/ \u7684\u5185\u5bb9<\/h5>\n<h5>\u53ea\u9700\u8981\u4e00\u79cd\u9009\u62e9\uff1a.git\/objects\/info\/commit-graph\u7684\u7ffb\u8bd1<\/h5>\n<p>.git\/objects\/info\/commit-graph -&gt; .git\/objects\/info\/commit-graph<\/p>\n<h5>.git\/objects\/info\/packs \u7684\u672c\u5730\u8bed\u8a00\u89e3\u91ca\uff1a\u8d30\u8f91\u653e\u7f6e\u4fe1\u606f\u6587\u4ef6\u5939<\/h5>\n<pre class=\"post-pre\"><code>.git\/objects\/pack\/pack-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.pack\u3078\u306e\u53c2\u7167\r\n<\/code><\/pre>\n<h5>.git\/objects\/ \u7684\u6587\u4ef6\u5939\u4e2d\u3001<\/h5>\n<p>\u5728\u4e00\u4e2a\u53ea\u6709\u4e24\u4e2a\u5b57\u7b26\u540d\u5b57\u7684\u76ee\u5f55\u4e2d\uff0c\u6709\u4e00\u4e2a\u6587\u4ef6\u540d\u4e3a38\u4e2a\u5b57\u7b26\u7684\u6587\u4ef6\u3002<br \/>\n\u8fd9\u4e2a\u75312+38\u517140\u4e2a\u5b57\u7b26\u7ec4\u6210\u7684\u5b57\u7b26\u4e32\u5c06\u6210\u4e3agit\u5bf9\u8c61\u7684\u54c8\u5e0c\u503c\u3002<\/p>\n<h5>.git\/objects\/pack\/ \u8fd9\u4e2a\u8def\u5f84\u662f\u6307\u5411Git\u7248\u672c\u63a7\u5236\u5de5\u5177\u4e2d\u7684\u4e00\u4e2a\u6587\u4ef6\u5939\u3002<\/h5>\n<p>\u6bcf\u6b21\u8fdb\u884cgit gc\uff0c\u6253\u5305\u7684\u6587\u4ef6\u5c06\u4f1a\u88ab\u5b58\u50a8\u3002\uff08\u5305\u62ecidx\u548cpack\u6587\u4ef6\uff09<br \/>\n\u6bcf\u6b21\u8fdb\u884cgit gc\u65f6\uff0c\u6587\u4ef6\u540d\u4f1a\u53d1\u751f\u6539\u53d8\u3002<\/p>\n<h5>.git\/refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\u7684\u4e2d\u6587\u540c\u4e49\u8bcd\u662f\uff1a.git\/refs\/heads\/\u5206\u652f\u540d\u3002<\/h5>\n<p>\u8fd9\u91cc\u6307\u7684\u662f\u6307\u5411\u672c\u5730\u6bcf\u4e2a\u5206\u652f\u6240\u6307\u7684\u63d0\u4ea4\u3002<\/p>\n<pre class=\"post-pre\"><code>\u30d6\u30e9\u30f3\u30c1\u306eHEAD\u304c\u6307\u3059\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\n<\/code><\/pre>\n<h5>.git\/refs\/remotes\/RemoteName\/HEAD<\/h5>\n<p>\u8fd9\u662f\u5bf9\u8fdc\u7a0b\u5206\u652f\u7684HEAD\u6307\u5411\u7684\u5206\u652f\u7684\u5f15\u7528\u3002<\/p>\n<pre class=\"post-pre\"><code>ref: refs\/remotes\/origin\/\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<h5>.git\/refs\/remotes\/remoteName\/branchName<\/h5>\n<p>\u8fd9\u91cc\u5305\u542b\u4e86\u6700\u540e\u4e00\u6b21\u83b7\u53d6\u7684\u8fdc\u7a0b\u4ee3\u7801\u5e93\u5206\u652f\u7684\u63d0\u4ea4\u4fe1\u606f\u3002<\/p>\n<pre class=\"post-pre\"><code>\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u306eHEAD\u304c\u6307\u3059commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\n<\/code><\/pre>\n<h5>.git \/ refs \/ tags \/ \u6807\u7b7e\u540d\u79f0<\/h5>\n<p>\u4f7f\u7528\u8f7b\u91cf\u7ea7\u6807\u7b7e\u548c\u6ce8\u91ca\u6807\u7b7e\u4f1a\u521b\u5efa\u6807\u7b7e\u540d\u79f0\u7684\u6587\u4ef6\u3002<\/p>\n<div>\n<div class=\"post-table\">tag\u306e\u7a2e\u985e\u53c2\u7167\u8efd\u91cf\u30bf\u30b0commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u30bf\u30b0tag\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/div>\n<\/div>\n<pre class=\"post-pre\"><code>tag\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<h5>.git\/refs\/stash &#8211;&gt; `.git\/refs\/stash`<\/h5>\n<pre class=\"post-pre\"><code>\u6700\u5f8c\u306b\u884c\u3063\u305fstash\u306ecommit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<h5>.git\/AUTO_MERGE\u7684\u4e2d\u6587\u8c10\u610f\u4e3a\uff1a\u81ea\u52a8\u5408\u5e76<\/h5>\n<pre class=\"post-pre\"><code>\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u3057\u3066\u3044\u308b\u72b6\u614b\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u542b\u3080commit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<h5>.git\/CHERRY_PICK_HEAD\u7684\u542b\u4e49<\/h5>\n<p>\u6211\u6b63\u5728\u8bb0\u5f55\u901a\u8fc7\u6311\u9009\u7cbe\u9009\u63d0\u4ea4\u5e76\u5408\u5e76\u5230\u5206\u652f\u4e0a\u7684commit\u3002<\/p>\n<pre class=\"post-pre\"><code>cherry-pick\u3057\u3066\u3044\u308bcommit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<h5>.git\/COMMIT_EDITMSG \u7684\u4e2d\u6587\u91ca\u4e49\uff1a\u8fd9\u662f\u4e00\u4e2a\u8def\u5f84\u540d\uff0c\u5b83\u6307\u5411\u4f4d\u4e8e`.git`\u76ee\u5f55\u4e0b\u7684`COMMIT_EDITMSG`\u6587\u4ef6\u3002<\/h5>\n<pre class=\"post-pre\"><code>\u6700\u5f8c\u306b\u5b9f\u884c\u3057\u305fcommit\u306e\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/code><\/pre>\n<h5>.git\/config \u53ef\u4ee5\u88ab\u91cd\u65b0\u8bf4\u660e\u4e3a\uff1a\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684 .git\/config\u3002<\/h5>\n<p>\u8fd9\u91cc\u5c06\u8bb0\u5f55\u4e0a\u6e38\u5206\u652f\u7684\u8bbe\u7f6e\u3002<\/p>\n<pre class=\"post-pre\"><code>[core]\r\n\trepositoryformatversion = 0\r\n\tfilemode = false\r\n\tbare = false\r\n\tlogallrefupdates = true\r\n\tsymlinks = false\r\n\tignorecase = true\r\n[remote \"\u30ea\u30e2\u30fc\u30c8\u540d\"]\r\n\turl = git@github.com:\u30e6\u30fc\u30b6\u30fc\u540d\/\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u540d.git\r\n\tfetch = +refs\/heads\/*:refs\/remotes\/\u30ea\u30e2\u30fc\u30c8\u540d\/*\r\n[branch \"\u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u540d\"]\r\n\tremote = \u30ea\u30e2\u30fc\u30c8\u540d\r\n    merge = refs\/heads\/\u4e0a\u6d41\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<h5>.git\/description -&gt; .git\/\u63cf\u8ff0<\/h5>\n<pre class=\"post-pre\"><code> \/\/\u7ffb\u8a33\uff1a\u7121\u540d\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb'description'\u3092\u7de8\u96c6\u3057\u3066\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u540d\u524d\u3092\u3064\u3051\u3066\u304f\u3060\u3055\u3044\u3002\r\n Unnamed repository; edit this file 'description' to name the repository.\r\n<\/code><\/pre>\n<h6>\u7528\u9014\u7684\u610f\u601d\u662f\u6307\u67d0\u7269\u54c1\u6216\u4e8b\u7269\u7684\u7528\u9014\u6216\u76ee\u7684\u3002<\/h6>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">gitweb<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30ea\u30dd\u30b8\u30c8\u30ea\u540d\u3092\u52d5\u7684\u306b\u8aad\u307f\u53d6\u308b\u30ab\u30b9\u30bf\u30e0\u30d5\u30c3\u30af\u306e\u958b\u767a\u7528<\/ul>\n<h5>.git\/FETCH_HEAD -&gt; .git\/\u6293\u53d6\u5386\u53f2<\/h5>\n<p>\u5f53\u6211\u4eec\u6267\u884cgit clone\u3001git fetch\u7b49\u64cd\u4f5c\u65f6\uff0c\u8fdc\u7a0b\u4ed3\u5e93\u7684\u72b6\u6001\u5c06\u88ab\u8bb0\u5f55\u4e0b\u6765\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">git clone\u3084git fetch(\u30d6\u30e9\u30f3\u30c1\u6307\u5b9a\u306a\u3057)\u3092\u3057\u305f\u5834\u5408\u306f\u8907\u6570\u304c\u8a18\u9332\u3055\u308c\u3066\u3044\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">git fetch \u30ea\u30e2\u30fc\u30c8\u540d \u30d6\u30e9\u30f3\u30c1\u540d\u306a\u3069\u30671\u3064\u306e\u30d6\u30e9\u30f3\u30c1\u3060\u3051fetch\u3057\u305f\u5834\u5408\u306f1\u3064\u3060\u3051\u8a18\u9332\u3055\u308c\u3066\u3044\u308b<\/ul>\n<pre class=\"post-pre\"><code><span class=\"go\">\u305d\u306e\u30d6\u30e9\u30f3\u30c1\u304c\u6307\u3059\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) (not-for-merge)\tbranch '\u30d6\u30e9\u30f3\u30c1\u540d' of github.com:\u30e6\u30fc\u30b6\u30fc\u540d\/\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u540d\r\n<\/span><\/code><\/pre>\n<p>\u5c06\u88ab\u5224\u5b9a\u4e3a\u4e0d\u9002\u5408\u5408\u5e76\u7684\u5206\u652f\u5c06\u663e\u793a\u4e3a\u300c\u975e\u5408\u5e76\u300d\u3002<\/p>\n<h5>.git\/HEAD -&gt; .git\/\u5934<\/h5>\n<p>\u76ee\u524d\u8bb0\u5f55\u7740\u5f53\u524d\u7684\u5206\u652f\u3002<br \/>\nref\u901a\u5e38\u6307\u7684\u662f\u5206\u652f\u3002<br \/>\n\u5f53HEAD\u76f4\u63a5\u6307\u5411\u4e00\u4e2a\u63d0\u4ea4\u65f6\uff0c\u79f0\u4e3a\u201c\u5206\u79bbHEAD\u201d\uff08\u4ece\u5206\u652f\u4e2d\u5206\u79bb\u51fa\u6765\u7684HEAD\uff09\u3002<br \/>\n\u53ef\u4ee5\u901a\u8fc7.git\/refs\/heads\/\u5206\u652f\u540d\u6765\u786e\u8ba4.git\/HEAD\u4e2d\u6307\u793a\u7684\u5206\u652f\u7684HEAD\u54c8\u5e0c\u3002<\/p>\n<pre class=\"post-pre\"><code>ref: refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<h5>.git\/index &#8211; .git\u76ee\u5f55\u7d22\u5f15<\/h5>\n<p>\u56e0\u4e3a\u5b83\u662f\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u6240\u4ee5\u5373\u4f7f\u7528\u7f16\u8f91\u5668\u6253\u5f00\u4e5f\u65e0\u6cd5\u67e5\u770b\u5176\u5185\u5bb9\u3002<br \/>\n\u8bb0\u5f55\u4e86\u6b63\u5728\u8ffd\u8e2a\u7684\u6587\u4ef6\u3002<\/p>\n<h5>.git\/MERGE_HEAD\u662f\u6307\u5411\u6b63\u5728\u8fdb\u884c\u5408\u5e76\u64cd\u4f5c\u7684\u5206\u652f\u7684\u5f15\u7528\u3002<\/h5>\n<p>\u6267\u884cgit merge\u547d\u4ee4\u65f6\uff0c\u5b83\u4f1a\u8bb0\u5f55\u8981\u5408\u5e76\u5230\u5206\u652f\u7684\u63d0\u4ea4\u3002<\/p>\n<pre class=\"post-pre\"><code>\u30de\u30fc\u30b8\u3055\u308c\u308b\u30d6\u30e9\u30f3\u30c1\u540d\u306eHEAD\u304c\u6307\u3059commit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<h5>.git\/MERGE_MODE \u53ef\u4ee5\u7528\u4ee5\u4e0b\u7684\u65b9\u5f0f\u5728\u4e2d\u6587\u8fdb\u884c\u7ffb\u8bd1\uff1a &#8220;.git\/\u5408\u5e76\u6a21\u5f0f&#8221;<\/h5>\n<p>\u8fd9\u53ea\u662f\u4e3a\u4e86\u901a\u77e5\u5408\u5e76\u6b63\u5728\u8fdb\u884c\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code>(\u7a7a)\r\n<\/code><\/pre>\n<h5>.git\/MERGE_MSG\uff1a\u5408\u5e76\u6d88\u606f<\/h5>\n<pre class=\"post-pre\"><code>\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u89e3\u6d88\u5f8c\u306egit commit\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/code><\/pre>\n<h5>.git\/ORIG_HEAD\u53ef\u4ee5\u88ab\u7b80\u5355\u5730\u7ffb\u8bd1\u4e3a&#8221;.git\/\u539f\u59cb\u5934\u6587\u4ef6&#8221;\u3002<\/h5>\n<p>\u5f53\u6267\u884c\u79fb\u52a8 HEAD \u7684\u547d\u4ee4\u65f6\uff0c\u4f1a\u8bb0\u5f55\u4e0b\u6267\u884c\u547d\u4ee4\u65f6 HEAD \u6240\u6307\u5411\u7684\u63d0\u4ea4\u7684\u54c8\u5e0c\u503c\u3002<\/p>\n<pre class=\"post-pre\"><code>commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\n<\/code><\/pre>\n<h5>.git\/FETCH_HEAD\u7684\u4e2d\u6587\u7ffb\u8bd1\u9009\u9879\uff1a.git\/\u62c9\u53d6\u5934<\/h5>\n<pre class=\"post-pre\"><code> commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\t\tbranch '\u30d6\u30e9\u30f3\u30c1\u540d' of github.com:\u30e6\u30fc\u30b6\u30fc\u540d\/\u30ea\u30dd\u30b8\u30c8\u30ea\u540d\r\n<\/code><\/pre>\n<h5>.git\/packed-refs -&gt; .git\/packed-refs<\/h5>\n<p>\u8fd0\u884cgit gc\u547d\u4ee4\u4f1a\u5220\u9664\u4e0d\u5fc5\u8981\u7684\u63d0\u4ea4\u7b49\uff0c\u5e76\u5c06\u5f15\u7528(ref)\u5408\u5e76\u5230\u4e00\u4e2a\u540d\u4e3apacked-refs\u7684\u6587\u4ef6\u4e2d\u3002\uff08\u5373\u4f7f\u4e0d\u660e\u786e\u6267\u884cgit gc\u547d\u4ee4\uff0c\u7cfb\u7edf\u4e5f\u4f1a\u81ea\u52a8\u8fd0\u884c\uff09<\/p>\n<h5>.git\/REBASE_HEAD =&gt; .git\/\u53d8\u57fa\u5934<\/h5>\n<p>\u5728\u6267\u884crebase\u4e4b\u524d\u8bb0\u5f55\u4e0b\u5206\u652f\u7684HEAD\u63d0\u4ea4\u3002<\/p>\n<pre class=\"post-pre\"><code>commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\n<\/code><\/pre>\n<h3>1-2. Git\u5bf9\u8c61 (Git object)<\/h3>\n<h4>Git\u5bf9\u8c61\uff08\u67094\u79cd\u7c7b\u578b\uff09<\/h4>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">commit<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">blob<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">tree<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">tag<\/ul>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/100-2.png\" alt=\"1-1-3.png\" \/><\/div>\n<h5>\u4eceGit\u5bf9\u8c61\u7c7b\u578b\uff08\u6839\u636e\u54c8\u5e0c\uff09<\/h5>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git cat-file <span class=\"nt\">-t<\/span> git\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<h5>\u67e5\u770bgit\u5bf9\u8c61<\/h5>\n<p>\u65e0\u6cd5\u4ece\u5de5\u4f5c\u6811\u6587\u4ef6\u8def\u5f84\u4e2d\u786e\u8ba4\u3002<br \/>\n\u56e0\u4e3a\u76f8\u540c\u7684\u6587\u4ef6\u8def\u5f84\u4f1a\u4fdd\u5b58\u591a\u4e2ablob\u5bf9\u8c61\uff0c\u6240\u4ee5\u65e0\u6cd5\u4ece\u6587\u4ef6\u8def\u5f84\u552f\u4e00\u786e\u5b9a\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/git\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\u304b\u3089\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git cat-file <span class=\"nt\">-p<\/span> git\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\"> \r\n\/\/\u30d6\u30e9\u30f3\u30c1\u540d\u304b\u3089\u78ba\u8a8d(\u30d6\u30e9\u30f3\u30c1\u540d\u306e\u5834\u5408\u306fcommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8)\r\n<\/span><span class=\"gp\">$<\/span> git cat-file <span class=\"nt\">-p<\/span> \u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<h5>\u5f53\u6211\u4eec\u4f7f\u7528git cat-file\u547d\u4ee4\u6765\u67e5\u770bcommit\u5bf9\u8c61\u65f6\uff0c\u53ef\u4ee5\u786e\u8ba4\u5230\u7684\u5185\u5bb9\u3002<\/h5>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30c8\u30c3\u30d7\u30ec\u30d9\u30eb\u306etree\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u306e\u53c2\u7167<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30b3\u30df\u30c3\u30c8\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u306e\u60c5\u5831<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u89aa\u30b3\u30df\u30c3\u30c8\u3078\u306e\u53c2\u7167(1\u3064\u524d\u306e\u30b3\u30df\u30c3\u30c8)<\/ul>\n<div>\n<div class=\"post-table\">\u89aa\u30b3\u30df\u30c3\u30c8\u306e\u6570\u4f8b0initial commit1\u901a\u5e38\u306e\u30b3\u30df\u30c3\u30c82merge commit\u3001stash3\u4ee5\u4e0aoctopus\u30de\u30fc\u30b8<\/div>\n<\/div>\n<h5>\u901a\u8fc7\u4f7f\u7528git cat-file\u547d\u4ee4\uff0c\u53ef\u4ee5\u786e\u8ba4blob\u5bf9\u8c61\u7684\u5185\u5bb9\u3002<\/h5>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4e2d\u8eab<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u203b\u30d5\u30a1\u30a4\u30eb\u540d\u3084\u30d1\u30b9\u306fblob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u306f\u306a\u304ftree\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u8a18\u9332\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u78ba\u8a8d\u3067\u304d\u307e\u305b\u3093\u3002<\/ul>\n<h5>\u5f53\u6211\u4eec\u4f7f\u7528`git cat-file`\u547d\u4ee4\u67e5\u770btree\u5bf9\u8c61\u65f6\uff0c\u53ef\u4ee5\u786e\u8ba4\u7684\u5185\u5bb9\u3002<\/h5>\n<p>\u7528\u4e2d\u6587\u672c\u5730\u5316\u4e3a\uff1a<br \/>\n\u8be5tree\u5bf9\u8c61\u6240\u5f15\u7528\u7684\u6bcf\u4e2aGit\u5bf9\u8c61\u7684<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30bf\u30a4\u30d7(blob or tree)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30cf\u30c3\u30b7\u30e5<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30d5\u30a1\u30a4\u30eb\u540d(\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d)<\/ul>\n<div>\n<div class=\"post-table\">\u6570\u5b57\u7a2e\u985e100644blob(\u901a\u5e38\u306e\u30d5\u30a1\u30a4\u30eb)120000\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af040000tree(\u30c7\u30a3\u30ec\u30af\u30c8\u30ea)100755\u5b9f\u884c\u53ef\u80fd\u30d5\u30a1\u30a4\u30eb<\/div>\n<\/div>\n<h5>\u5f53\u4f60\u5bf9tag\u5bf9\u8c61\u8fdb\u884cgit cat-file\u64cd\u4f5c\u65f6\uff0c\u53ef\u4ee5\u786e\u8ba4\u7684\u5185\u5bb9\u3002<\/h5>\n<div>\n<div class=\"post-table\">tag\u306e\u7a2e\u985e\u53c2\u7167\u306a\u3069\u8efd\u91cf\u30bf\u30b0commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u30bf\u30b0tag\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u306e\u53c2\u7167\u3001\u30e1\u30c3\u30bb\u30fc\u30b8<\/div>\n<\/div>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u73fe\u5728\u306eHEAD\u304c\u6307\u3059commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u8efd\u91cf\u30bf\u30b0\u3092\u3064\u3051\u308b\r\n<\/span><span class=\"gp\">$<\/span> git tag \u30bf\u30b0\u540d\r\n<span class=\"go\">\r\n\/\/commit\u3092\u6307\u5b9a\u3057\u3066\u8efd\u91cf\u30bf\u30b0\u3092\u3064\u3051\u308b\r\n<\/span><span class=\"gp\">$<\/span> git tag \u30bf\u30b0\u540d \u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\">\r\n\/\/\u73fe\u5728\u306eHEAD\u304c\u6307\u3059commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u30bf\u30b0\u3092\u3064\u3051\u308b\r\n<\/span><span class=\"gp\">$<\/span> git tag <span class=\"nt\">-a<\/span> \u30bf\u30b0\u540d <span class=\"nt\">-m<\/span> <span class=\"s2\">\"\u30e1\u30c3\u30bb\u30fc\u30b8\"<\/span>\r\n<span class=\"go\">\r\n\/\/commit\u3092\u6307\u5b9a\u3057\u3066\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u30bf\u30b0\u3092\u3064\u3051\u308b\r\n<\/span><span class=\"gp\">$<\/span> git tag <span class=\"nt\">-a<\/span> \u30bf\u30b0\u540d <span class=\"nt\">-m<\/span> <span class=\"s2\">\"\u30e1\u30c3\u30bb\u30fc\u30b8\"<\/span> commit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<h5>\u786e\u8ba4\u5df2\u7ecf\u6dfb\u52a0\u4e86\u6807\u7b7e\u3002<\/h5>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git log\r\n<\/code><\/pre>\n<h5>.git\/refs\/tags\/\u4f1a\u521b\u5efa\u6807\u7b7e\u540d<\/h5>\n<pre class=\"post-pre\"><code> \u53c2\u7167\u3059\u308bcommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(\u8efd\u91cf\u30bf\u30b0\u306e\u5834\u5408)\r\n \u53c2\u7167\u3059\u308btag\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u30bf\u30b0\u306e\u5834\u5408)\r\n<\/code><\/pre>\n<h5>\u786e\u8ba4\u6807\u6ce8\u6807\u7b7e\uff08\u6807\u7b7e\u5bf9\u8c61\uff09\u3002<\/h5>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git cat-file <span class=\"nt\">-p<\/span> \u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\">\r\nobject \u53c2\u7167\u3059\u308bcommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\ntype commit\r\ntag \u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u30bf\u30b0\u540d\r\n<\/span><span class=\"gp\">tagger \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span> UNIX\u6642\u9593 +0900\r\n<span class=\"go\">\r\n\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/span><\/code><\/pre>\n<h5>\u5176\u4ed6<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30bf\u30b0\u306e\u78ba\u8a8d(\u30ed\u30fc\u30ab\u30eb)\r\n<\/span><span class=\"gp\">$<\/span> git tag\t\r\n<span class=\"go\">\r\n\/\/\u30bf\u30b0\u306e\u78ba\u8a8d(\u30ea\u30e2\u30fc\u30c8)\r\n<\/span><span class=\"gp\">$<\/span> git ls-remote <span class=\"nt\">--tags<\/span>\r\n<span class=\"go\">\r\n\/\/\u30bf\u30b0\u306e\u4e2d\u8eab\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git show \u30bf\u30b0\u540d\t\r\n<span class=\"go\">\u3000\r\n\/\/\u7279\u5b9a\u306e\u30bf\u30b0\u3092\u524a\u9664(\u30ed\u30fc\u30ab\u30eb)\r\n<\/span><span class=\"gp\">$<\/span> git tag <span class=\"nt\">-d<\/span> \u30bf\u30b0\u540d\r\n<span class=\"go\">\r\n\/\/\u7279\u5b9a\u306e\u30bf\u30b0\u3092\u524a\u9664(\u30ea\u30e2\u30fc\u30c8)\r\n<\/span><span class=\"gp\">$<\/span> git push \u30ea\u30e2\u30fc\u30c8\u540d <span class=\"nt\">--delete<\/span> \u30bf\u30b0\u540d\r\n<span class=\"go\">\r\n\/\/\u30bf\u30b0\u3092\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u30d7\u30c3\u30b7\u30e5(\u3059\u3079\u3066\u306e\u30bf\u30b0)\r\n<\/span><span class=\"gp\">$<\/span> git push <span class=\"nt\">--tag<\/span>\r\n<span class=\"go\"> \r\n\/\/\u30bf\u30b0\u3092\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u30d7\u30c3\u30b7\u30e5(\u7279\u5b9a\u306e\u30bf\u30b0)\r\n<\/span><span class=\"gp\">$<\/span> git push \u30ea\u30e2\u30fc\u30c8\u540d \u30bf\u30b0\u540d\r\n<\/code><\/pre>\n<h3>1-3. \u53c2\u8003\uff08\u5f15\u7528\uff09<\/h3>\n<h4>branch (\u5206\u652f) \u6307\u7684\u662f<\/h4>\n<p>\u8fd9\u662f\u5728commit\u4e0a\u7684\u6307\u9488\u3002\u5f53commit\u524d\u8fdb\u65f6\uff0c\u5b83\u4f1a\u81ea\u52a8\u79fb\u52a8\u3002\u53ef\u4ee5\u901a\u8fc7\u5206\u652f\u540d\u79f0\u6307\u5b9acommit\u3002<\/p>\n<h4>\u5206\u884c\u7684\u786e\u8ba4<\/h4>\n<h5>Git\u64cd\u4f5c &#8211; Git\u64cd\u4f5c\u53ef\u4ee5\u7406\u89e3\u4e3a\u5bf9Git\u7248\u672c\u63a7\u5236\u5de5\u5177\u7684\u64cd\u4f5c\u3002<\/h5>\n<p>Please note that the provided translation from English to Chinese is a direct paraphrase of the phrase. Context may affect the accurate translation.<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/branch\u306e\u78ba\u8a8d(\u30ed\u30fc\u30ab\u30eb)\r\n<\/span><span class=\"gp\">$<\/span> git branch\t\r\n<span class=\"go\">\r\n\/\/branch\u306e\u78ba\u8a8d(\u30ed\u30fc\u30ab\u30eb\u3068\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1)\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">-a<\/span>\r\n<span class=\"gp\">$<\/span> git branch <span class=\"nt\">--all<\/span>\r\n<span class=\"go\">\r\n\/\/branch\u306e\u78ba\u8a8d(\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1)\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">-r<\/span>\r\n<span class=\"gp\">$<\/span> git branch <span class=\"nt\">--remotes<\/span>\r\n<\/code><\/pre>\n<h4>\u8bbe\u7f6e\u4e0a\u6e38\u5206\u652f<\/h4>\n<h5>Git \u64cd\u4f5c<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/branch\u306e\u78ba\u8a8d(\u30ed\u30fc\u30ab\u30eb\u3068\u4e0a\u6d41\u306e\u5bfe\u5fdc)\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">-vv<\/span>\r\n<span class=\"go\">\r\n\/\/\u4e0a\u6d41\u30d6\u30e9\u30f3\u30c1\u306e\u8a2d\u5b9a(\u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u3068\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u306e\u7d10\u4ed8\u3051)\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">-u<\/span> \u30ea\u30e2\u30fc\u30c8\u540d\/\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u540d \u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u540d\t\r\n<span class=\"go\">\r\n\/\/\u4e0a\u6d41\u30d6\u30e9\u30f3\u30c1\u306e\u8a2d\u5b9a(\u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u3068\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u306e\u7d10\u4ed8\u3051)\u306e\u89e3\u9664\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">--unset-upstream<\/span> \u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u5939\u4e2d\u53d1\u751f\u7684\u60c5\u51b5<\/h5>\n<p>\u5982\u679c\u8fdb\u884c\u8bbe\u5b9a\uff0c\u4e0b\u9762\u7684\u5185\u5bb9\u4f1a\u88ab\u8ffd\u52a0\uff0c\u5982\u679c\u8fdb\u884c\u5220\u9664\uff0c\u5b83\u4f1a\u6d88\u5931\u3002<\/p>\n<pre class=\"post-pre\"><code>[branch \"\u30d6\u30e9\u30f3\u30c1\u540d\"]\r\n    remote = \u30ea\u30e2\u30fc\u30c8\u540d\r\n    merge = refs\/heads\/\u4e0a\u6d41\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<h4>\u5220\u9664\u8fdc\u7a0b\u8ffd\u8e2a\u5206\u652f<\/h4>\n<h5>Git\u64cd\u4f5c\u7684\u540c\u4e49\u8bcd\u77ed\u8bed\uff1a<br \/>\nGit\u547d\u4ee4<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u7279\u5b9a\u306e\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u306e\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">-d<\/span> <span class=\"nt\">-r<\/span> \u30ea\u30e2\u30fc\u30c8\u540d\/\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u540d\t\r\n<span class=\"go\">\u3000\r\n\/\/\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u306e\u524a\u9664(\u30ea\u30e2\u30fc\u30c8\u3067\u524a\u9664\u3055\u308c\u305f\u3082\u306e)\r\n<\/span><span class=\"gp\">$<\/span> git fetch <span class=\"nt\">--prune<\/span>\r\n<span class=\"gp\">$<\/span> git fetch <span class=\"nt\">-p<\/span>\r\n<span class=\"gp\">$<\/span> git remote prune \u30ea\u30e2\u30fc\u30c8\u540d\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u5939\u4e2d\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<p>.git\/refs\/remotes\/\u30ea\u30e2\u30fc\u30c8\u540d\/\u30d6\u30e9\u30f3\u30c1\u540d\u5c06\u88ab\u5220\u9664\u3002<\/p>\n<h4>\u521b\u5efa\u5206\u652f<\/h4>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/144-0.png\" alt=\"2-1-4.png\" \/><\/div>\n<h5>Git\u64cd\u7eb5<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u73fe\u5728\u306ecommit\u304b\u3089branch\u3092\u4f5c\u6210\r\n<\/span><span class=\"gp\">$<\/span> git branch \u4f5c\u6210\u3059\u308b\u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/\u7279\u5b9a\u306ecommit\u304b\u3089branch\u3092\u4f5c\u6210\r\n<\/span><span class=\"gp\">$<\/span> git branch \u4f5c\u6210\u3059\u308b\u30d6\u30e9\u30f3\u30c1\u540d commit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\">\r\n\/\/\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u304b\u3089\u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u306e\u4f5c\u6210\r\n<\/span><span class=\"gp\">$<\/span> git branch \u4f5c\u6210\u3059\u308b\u30d6\u30e9\u30f3\u30c1\u540d \u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u5939\u5185\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<ul class=\"post-ul\">.git\/refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\u304c\u4f5c\u6210\u3055\u308c\u308b<\/ul>\n<pre class=\"post-pre\"><code>branch\u304c\u6307\u3059commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">.git\/logs\/refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\u304c\u4f5c\u6210\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30ed\u30b0\u304c\u4e0b\u306b\u8ffd\u8a18\u3055\u308c\u3066\u3044\u304d\u307e\u3059\u3002<\/ul>\n<pre class=\"post-pre\"><code>\u89aacommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5 commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5 \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; Linux\u6642\u9593 +0900\tbranch: Created from \u4f5c\u6210\u5143\u306e\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<p>\u6700\u521d\u884c\u7684\u201c\u89aa commit \u7269\u4ef6\u7684\u54c8\u5e0c\u503c\u201d\u5c06\u4f1a\u662f\u201c0000000000000000000000000000000000000000\u201d\u3002<br \/>\n\u6700\u540e\u884c\u7684 commit \u7269\u4ef6\u7684\u54c8\u5e0c\u503c\u5c06\u4e0e .git\/refs\/heads\/\u5206\u652f\u540d \u4e2d\u6240\u8bb0\u5f55\u7684\u503c\u76f8\u5339\u914d\u3002<\/p>\n<h4>\u786e\u8ba4\u5728`.git\/refs\/heads\/`\u5206\u652f\u540d\u79f0\u4e0b\u6240\u5199\u7684\u662f\u4e00\u4e2a\u63d0\u4ea4\u5bf9\u8c61\u7684\u5185\u5bb9<\/h4>\n<p>\u4f7f\u7528git cat-file\u547d\u4ee4\u6765\u67e5\u627e\u4fdd\u5b58\u5728.git\/refs\/heads\/\u5206\u652f\u540d\u79f0\u6587\u4ef6\u4e2d\u7684\u54c8\u5e0c\u503c\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git cat-file <span class=\"nt\">-p<\/span> .git\/refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\"> \r\ntree tree\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\nparent \u89aacommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/span><span class=\"gp\">author \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span> UNIX\u6642\u9593 +0900\r\n<span class=\"gp\">committer \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span> UNIX\u6642\u9593 +0900\r\n\r\n \r\n<span class=\"gp\">$<\/span> git cat-file <span class=\"nt\">-t<\/span> commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\"> \r\ncommit\r\n<\/span><\/code><\/pre>\n<p>\u53ef\u4ee5\u786e\u8ba4\u5b58\u5728\u63d0\u4ea4\u5bf9\u8c61\u3002<\/p>\n<h4>\u5206\u652f\u7684\u5207\u6362<\/h4>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/158-0.png\" alt=\"2-1-1.png\" \/><\/div>\n<h5>Git\u64cd\u7eb5<\/h5>\n<p>\u5982\u679c\u5728\u5de5\u4f5c\u533a\u4e0a\u6709\u66f4\u6539\u6216\u8005\u5728\u6682\u5b58\u533a\u540e\u5207\u6362\u5230\u5176\u4ed6\u5206\u652f\u800c\u6ca1\u6709\u8fdb\u884c\u63d0\u4ea4\uff0c\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f<br \/>\n\u5982\u679c\u5b58\u5728\u51b2\u7a81\u7684\u66f4\u6539\uff0c\u5c31\u65e0\u6cd5\u5207\u6362\u5230\u5176\u4ed6\u5206\u652f\uff08\u4e3a\u4e86\u9632\u6b62\u4e22\u5931\u5de5\u4f5c\uff0cGit\u4f1a\u963b\u6b62\u5207\u6362\uff09<br \/>\n\u5982\u679c\u6ca1\u6709\u51b2\u7a81\u7684\u66f4\u6539\uff08\u5373\u7f16\u8f91\u90e8\u5206\u4e0d\u53d1\u751f\u51b2\u7a81\uff0c\u6216\u8005\u662f\u65b0\u6587\u4ef6\u7b49\u60c5\u51b5\uff09\uff0c\u53ef\u4ee5\u4fdd\u7559\u66f4\u6539\u5e76\u5207\u6362\u5206\u652f\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/branch\u3092\u6307\u5b9a\u3057\u3066\u5207\u308a\u66ff\u3048\r\n<\/span><span class=\"gp\">$<\/span> git switch \u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\"> \r\n\/\/branch\u3092\u4f5c\u6210\u3057\u3066\u5207\u308a\u66ff\u3048\r\n<\/span><span class=\"gp\">$<\/span> git switch <span class=\"nt\">-c<\/span> \u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\"> \r\n\/\/\u6307\u5b9a\u3057\u305f\u30b3\u30df\u30c3\u30c8\u304b\u3089branch\u3092\u4f5c\u6210\u3057\u3066\u5207\u308a\u66ff\u3048\r\n<\/span><span class=\"gp\">$<\/span> git switch <span class=\"nt\">-d<\/span> \u30d6\u30e9\u30f3\u30c1\u540d branch\u3092\u4f5c\u6210\u3057\u305f\u3044commit\u306e\u30cf\u30c3\u30b7\u30e5\t\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u5939\u5185\u53d1\u751f\u7684\u4e8b\u60c5\u3002<\/h5>\n<ul class=\"post-ul\">.git\/HEAD\u304c\u66f4\u65b0\u3055\u308c\u308b<\/ul>\n<pre class=\"post-pre\"><code>ref: refs\/heads\/\u5207\u308a\u66ff\u3048\u5f8c\u306e\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">index\u304c\u5207\u308a\u66ff\u3048\u5f8c\u306ebranch\u306e\u8ffd\u8de1\u6e08\u307f\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u306b\u5207\u308a\u66ff\u308f\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">FETCH_HEAD\u306f\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u304c\u66f4\u65b0\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">.git\/logs\/HEAD\u306e\u4e0b\u306b\u30ed\u30b0\u304c\u8ffd\u8a18\u3055\u308c\u308b<\/ul>\n<h4>\u6e38\u79bb\u7684HEAD<\/h4>\n<p>\u5982\u679c\u4e0d\u901a\u8fc7\u5206\u652f\uff0c\u76f4\u63a5\u5f15\u7528\u63d0\u4ea4\u5bf9\u8c61\uff0c\u5219\u72b6\u6001\u4f1a\u53d8\u4e3a\u5206\u79bb\u5934(\u65e0\u5206\u652f)\u7684\u72b6\u6001\u3002<\/p>\n<p>\u7528\u9014\u53ef\u4ee5\u4e3a\u2026<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u904e\u53bb\u306ecommit\u306e\u72b6\u614b\u306e\u518d\u73fe<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u5b9f\u9a13\u7684\u306b\u5909\u66f4\u3092\u52a0\u3048\u3066\u307f\u308b<\/ul>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/170-0.png\" alt=\"2-1-15.png\" \/><\/div>\n<h5>\u5728\u5206\u79bb\u7684 HEAD \u72b6\u6001\u4e0b\u5207\u6362\u5230\u7279\u5b9a\u7684\u63d0\u4ea4<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30d6\u30e9\u30f3\u30c1\u540d\u3092\u4ecb\u3055\u305a\u30b3\u30df\u30c3\u30c8\u3092\u76f4\u63a5\u6307\u5b9a\u3057\u3066\u5207\u308a\u66ff\u3048\u308b\r\n<\/span><span class=\"gp\">$<\/span> git switch <span class=\"nt\">-d<\/span> \u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"gp\">$<\/span> git switch <span class=\"nt\">--detach<\/span> \u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<p>\u5728\u5206\u79bb\u7684HEAD\u72b6\u6001\u4e0b\uff0c\u867d\u7136\u53ef\u4ee5\u8fdb\u884ccommit\uff0c\u4f46\u5f53\u5207\u6362\u5230\u5176\u4ed6\u5206\u652f\u65f6\u65e0\u6cd5\u8fdb\u884c\u5f15\u7528\u3002<br \/>\n\uff08\u5982\u679c\u8bb0\u5f55\u4e86commit\u7684\u54c8\u5e0c\u503c\uff0c\u5219\u53ef\u4ee5\u56de\u9000\u3002\uff09<\/p>\n<h5>\u786e\u8ba4\u5f53\u524d\u4e3a&#8221;detached HEAD&#8221;\u72b6\u6001<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git status\r\n<span class=\"go\"> \r\nHEAD detached at xxxxxx\r\n\r\n  \r\n\/\/\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git branch\r\n<span class=\"go\">  \r\n* (HEAD detached at xxxxxxx)\r\n<\/span><\/code><\/pre>\n<p>\u53ef\u4ee5\u5728.git\/HEAD\u4e2d\u8fdb\u884c\u786e\u8ba4\u3002<\/p>\n<pre class=\"post-pre\"><code>branch\u306e\u30d1\u30b9\u3067\u306f\u306a\u304f\u3001\u76f4\u63a5commit\u306e\u30cf\u30c3\u30b7\u30e5\u304c\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\r\n<\/code><\/pre>\n<h5>\u89e3\u79bbHEAD\u72b6\u6001\u3002<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u8a66\u3057\u305f\u3082\u306e\u3092\u7834\u68c4\u3057\u305f\u3044\u5834\u5408\u306f\u4ed6\u306e\u65e2\u5b58\u306e\u30d6\u30e9\u30f3\u30c1\u306b\u5207\u308a\u66ff\u3048\u308b\r\n<\/span><span class=\"gp\">$<\/span> git switch \u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/\u8a66\u3057\u305f\u3082\u306e\u3092\u4f7f\u3044\u305f\u3044\u5834\u5408\u306f\u3001\u65b0\u898f\u306bbranch\u3092\u4f5c\u308b\r\n<\/span><span class=\"gp\">$<\/span> git branch \u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<h4>\u66f4\u6539\u5206\u652f\u540d\u79f0<\/h4>\n<h5>Git \u64cd\u4f5c<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30d6\u30e9\u30f3\u30c1\u540d\u306e\u5909\u66f4(\u5909\u66f4\u5f8c\u306e\u540d\u524d\u3068\u540c\u540d\u30d6\u30e9\u30f3\u30c1\u304c\u3042\u308b\u3068\u5931\u6557)\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">-m<\/span> \u5909\u66f4\u524d\u306e\u30d6\u30e9\u30f3\u30c1\u540d \u5909\u66f4\u5f8c\u306e\u30d6\u30e9\u30f3\u30c1\u540d\t\r\n<span class=\"go\"> \r\n\/\/\u73fe\u5728\u306e\u30d6\u30e9\u30f3\u30c1\u540d\u3092\u5909\u66f4\u3059\u308b(\u5f37\u5236\u4e0a\u66f8\u304d)\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">-M<\/span> \u5909\u66f4\u5f8c\u306e\u30d6\u30e9\u30f3\u30c1\u540d\t\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u5939\u5185\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">.git\/refs\/heads\/\u65e7\u30d6\u30e9\u30f3\u30c1\u540d\u2192\u65b0\u30d6\u30e9\u30f3\u30c1\u540d<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">.git\/logs\/refs\/heads\/\u65e7\u30d6\u30e9\u30f3\u30c1\u540d\u2192\u65b0\u30d6\u30e9\u30f3\u30c1\u540d<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u73fe\u5728\u306e\u30d6\u30e9\u30f3\u30c1\u306e\u540d\u524d\u3092\u5909\u66f4\u3059\u308b\u3068.git\/HEAD\u3082\u66f8\u304d\u63db\u308f\u308b<\/ul>\n<h4>\u5220\u9664\u5206\u652f<\/h4>\n<h5>Git\u64cd\u4f5c\u6307\u7684\u662f\u4f7f\u7528Git\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u8fdb\u884c\u9879\u76ee\u7ba1\u7406\u7684\u8fc7\u7a0b\u3002<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/branch\u3092\u524a\u9664(\u4ed6\u306ebranch\u306bmerge\u6e08\u306ebranch\u306e\u307f)\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">-d<\/span> \u524a\u9664\u3057\u305f\u3044\u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/branch\u3092\u524a\u9664(\u4ed6\u306ebranch\u306bmerge\u3057\u3066\u3044\u306a\u3044branch\u3082\u524a\u9664\u53ef\u80fd)\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">-D<\/span> \u524a\u9664\u3057\u305f\u3044\u30d6\u30e9\u30f3\u30c1\u540d \r\n<\/code><\/pre>\n<h5>\u5728.git\u4e2d\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">.git\/config\u304c\u5909\u66f4\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30ea\u30e2\u30fc\u30c8\u306bpush\u6e08\u306ebranch\u3092\u524a\u9664\u3059\u308b\u3068\u3001\u4e0b\u8a18\u304c\u524a\u9664\u3055\u308c\u308b<\/ul>\n<pre class=\"post-pre\"><code>[branch \"\u524a\u9664\u3057\u305f\u30d6\u30e9\u30f3\u30c1\u540d\"]\r\n    remote = origin\r\n\tmerge = refs\/heads\/\u524a\u9664\u3057\u305f\u4e0a\u6d41\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">.git\/refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\u3000\u304c\u524a\u9664\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">.git\/logs\/refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\u3000\u304c\u524a\u9664\u3055\u308c\u308b<\/ul>\n<h4>\u5220\u9664\u8fdc\u7a0b\u5206\u652f<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u306e\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git push <span class=\"nt\">-d<\/span>\u30ea\u30e2\u30fc\u30c8\u540d \u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<h4>\u6062\u590d\u5df2\u5220\u9664\u7684\u672c\u5730\u5206\u652f<\/h4>\n<h5>Git\u4f7f\u7528<\/h5>\n<p>\u4e3a\u4e86\u786e\u8ba4\u8981\u6062\u590d\u54ea\u4e2a\u63d0\u4ea4\uff0c\u6211\u4eec\u5c06\u663e\u793aHEAD\u7684\u5386\u53f2\u8bb0\u5f55\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git reflog\r\n<\/code><\/pre>\n<p>\u6211\u4f1a\u8bd5\u7740\u771f\u6b63\u590d\u6d3b\u5b83\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git branch \u5fa9\u6d3b\u5f8c\u306e\u30d6\u30e9\u30f3\u30c1\u540d HEAD@<span class=\"o\">{<\/span>n<span class=\"o\">}<\/span>\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u5939\u5185\u53d1\u751f\u7684\u4e8b\u60c5\u3002<\/h5>\n<ul class=\"post-ul\">.git\/refs\/heads\/\u5fa9\u6d3b\u5f8c\u306e\u30d6\u30e9\u30f3\u30c1\u540d \u304c\u4f5c\u6210\u3055\u308c\u308b<\/ul>\n<pre class=\"post-pre\"><code>branch\u304c\u6307\u3059commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<ul class=\"post-ul\">.git\/logs\/refs\/heads\/\u5fa9\u6d3b\u5f8c\u306e\u30d6\u30e9\u30f3\u30c1\u540d \u304c\u4f5c\u6210\u3055\u308c\u308b<\/ul>\n<pre class=\"post-pre\"><code>0000000000000000000000000000000000000000 commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5 \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; Linux\u6642\u9593 +0900\r\nbranch: Created from HEAD@{n}\r\n<\/code><\/pre>\n<h4>\u5982\u679c\u6ca1\u6709\u63d0\u4ea4\u800c\u5207\u6362\u5206\u652f\uff08\u4e0d\u4f7f\u7528stash\u7684\u60c5\u51b5\uff09\uff0c<\/h4>\n<p>\u7531\u4e8e\u5de5\u4f5c\u6811\u4e2d\u7684\u6587\u4ef6\u548c\u6682\u5b58\u7684\u6587\u4ef6\u672a\u4e0e\u63d0\u4ea4\u5bf9\u8c61\u76f8\u5173\u8054\uff0c\u56e0\u6b64\u5b83\u4eec\u4f1a\u4e0e\u5207\u6362\u540e\u7684\u5206\u652f\u6df7\u5408\u5728\u4e00\u8d77\uff08\u6216\u8005\u5728\u51b2\u7a81\u65f6\u65e0\u6cd5\u8fdb\u884c\u5207\u6362\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u304c\u3076\u3064\u304b\u308b\u5834\u5408\r\nerror: Your local changes to the following files would be overwritten by checkout:\r\nPlease commit your changes or stash them before you switch branches.\r\n\r\n\/\/\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u304c\u3076\u3064\u304b\u308b\u5834\u5408(untracked file\u304c\u3076\u3064\u304b\u308b)\r\nerror: The following untracked working tree files would be overwritten by checkout:\r\nPlease move or remove them before you switch branches.\r\n<\/span><\/code><\/pre>\n<h4>\u5982\u679c\u5728\u4e0d\u63d0\u4ea4\u53d8\u66f4\u7684\u60c5\u51b5\u4e0b\u5207\u6362\u5206\u652f\uff08\u4f7f\u7528stash\uff09\uff0c<\/h4>\n<p>\u5c06\u6587\u4ef6\u50a8\u85cf\u540e\u5207\u6362\u5206\u652f\u5e76\u8fdb\u884cgit stash pop\uff0c\u4f1a\u8fdb\u884c\u81ea\u52a8\u5408\u5e76\u3002\u5982\u679c\u4e0d\u4ea7\u751f\u51b2\u7a81\uff0c\u5728\u90a3\u4e2a\u65f6\u523b\uff0c\u6682\u5b58\u533a\u5c06\u4fdd\u6301\u539f\u672c\u5b58\u5728\u7684\u72b6\u6001\u3002\u5982\u679c\u4ea7\u751f\u51b2\u7a81\uff0c\u5c06\u53d8\u4e3aboth added\u3002\u5728\u90a3\u4e2a\u65f6\u523b\u68c0\u67e5\u6682\u5b58\u533a\u65f6\uff0c\u540c\u4e00\u4e2a\u6587\u4ef6\u5c06\u6709\u4e24\u4efd\uff08\u54c8\u5e0c\u503c\u4e0d\u540c\uff09\u3002\u5982\u679c\u89e3\u51b3\u51b2\u7a81\u65f6\u53ea\u91c7\u7528\u5176\u4e2d\u7684\u4e00\u65b9\uff0c\u90a3\u4e00\u65b9\u7684\u54c8\u5e0c\u503c\u5c06\u4fdd\u7559\u4e0d\u53d8\u3002<\/p>\n<h4>\u6697\u4e2d\u5b58\u653e<\/h4>\n<p>\u5728\u89c6\u89c9\u4e0a\uff0c\u5c06\u5c1a\u672a\u8fdb\u884c\u672c\u5730\u63d0\u4ea4\u7684\u5185\u5bb9\uff08\u65e0\u8bba\u662f\u5426\u5904\u4e8e\u6682\u5b58\u72b6\u6001\uff09\u4e34\u65f6\u907f\u96e3\u4e00\u4e0b\uff08\u5b9e\u9645\u4e0a\u5c06\u88ab\u63d0\u4ea4\uff09\u3002\u6682\u5b58\u7684\u5bf9\u8c61\u662fGit\u7ba1\u7406\u4e0b\u7684\u6587\u4ef6\uff08\u672a\u8ffd\u8e2a\u7684\u6587\u4ef6\u5c06\u4e0d\u4f1a\u88ab\u907f\u907f\uff09\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/212-0.png\" alt=\"2-1-2.png\" \/><\/div>\n<h5>\u4f7f\u7528\u6848\u4f8b<\/h5>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u3044\u307e\u3059\u3050\u5225\u306ebranch\u3067\u4f5c\u696d\u3057\u305f\u3044\u3053\u3068\u304c\u3067\u304d\u305f\u3051\u3069\u73fe\u5728\u306e\u4f5c\u696d\u5185\u5bb9\u3092commit\u3057\u305f\u304f\u306a\u3044\u3068\u304d<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u4f5c\u696d\u30d6\u30e9\u30f3\u30c1\u3092\u9593\u9055\u3048\u305f\u3068\u304d\u306b\u4eca\u307e\u3067\u306e\u4f5c\u696d\uff08commit\u3057\u3066\u3044\u306a\u3044\u3082\u306e\u306b\u9650\u308b\uff09\u3092\u6b63\u3057\u3044branch\u306b\u9069\u7528\u3057\u305f\u3044\u3068\u304d<\/ul>\n<h5>Git\u7684\u4f7f\u7528\u65b9\u6cd5<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u5909\u66f4\u5dee\u5206\u3092\u9000\u907f\u3055\u305b\u308b(untracked file\u306f\u9000\u907f\u3055\u308c\u306a\u3044)\r\n<\/span><span class=\"gp\">$<\/span> git stash\r\n<span class=\"go\"> \r\n\/\/\u5909\u66f4\u5dee\u5206\u3092\u9000\u907f\u3055\u305b\u308b(\u540d\u524d\u4ed8\u304d\u3001untracked file\u306f\u9000\u907f\u3055\u308c\u306a\u3044)\r\n\/\/git stash list\u3067\u9000\u907f\u306e\u30ea\u30b9\u30c8\u3092\u898b\u308b\u3068\u304d\u306b\u4fbf\u5229\r\n<\/span><span class=\"gp\">$<\/span> git stash save \u30b9\u30bf\u30c3\u30b7\u30e5\u540d\r\n<span class=\"go\">\r\n  \r\n\/\/\u5909\u66f4\u5dee\u5206\u3092\u9000\u907f\u3055\u305b\u308b(untracked file\u3082\u5909\u66f4\u3082\u9000\u907f\u3055\u308c\u308b)\r\n<\/span><span class=\"gp\">$<\/span> git stash <span class=\"nt\">-u<\/span>\r\n<span class=\"go\"> \r\n\/\/\u5909\u66f4\u3092\u9000\u907f\u3055\u305b\u308b(\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u306f\u9664\u5916)\r\n<\/span><span class=\"gp\">$<\/span> git stash <span class=\"nt\">-k<\/span>\t\r\n<span class=\"gp\">$<\/span> git stash <span class=\"nt\">--keep-index<\/span>\r\n<\/code><\/pre>\n<h5>\u53d1\u751f\u5728.git\u5185\u90e8\u7684\u4e8b\u60c5<\/h5>\n<p>\u5f53\u6211\u8fdb\u884c\u5b58\u50a8\u7684\u65f6\u5019<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ORIG_HEAD\u306f\u304b\u308f\u3089\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">HEAD\u306f\u304b\u308f\u3089\u306a\u3044(\u30cf\u30c3\u30b7\u30e5\u306f\u66f4\u65b0\u3055\u308c\u306a\u3044\u306e\u3067\u30d6\u30e9\u30f3\u30c1\u81ea\u4f53\u306b\u306f\u5f71\u97ff\u3092\u4e0e\u3048\u306a\u3044)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u3068\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u306fHEAD\u3068\u540c\u3058\u72b6\u614b\u306b\u306a\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">reflog\u306f\u5897\u3048\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u300c.git\/refs\/stash\u300d\u3068\u300c.git\/logs\/refs\/stash\u300d\u304c\u4f5c\u6210(\u3059\u3067\u306b\u3042\u308b\u5834\u5408\u306f\u5909\u66f4)\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u300c.git\/refs\/stash\u300d\u306f\u6700\u65b0\u306estash\u306ecommit\u306e\u30cf\u30c3\u30b7\u30e5<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u300c.git\/logs\/refs\/stash\u300d\u306f\u73fe\u5728stash\u306ecommit\u3059\u3079\u3066\u306e\u30cf\u30c3\u30b7\u30e5<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">stash\u306f\u30b3\u30df\u30c3\u30c8(stash\u3059\u308b\u3082\u306e\u3082\u3001\u3057\u306a\u3044\u3082\u306e\u3082\u542b\u3080\u30b3\u30df\u30c3\u30c8)\u3000\u89aa2\u3064\u3000\u5143\u3005\u306e\u30b3\u30df\u30c3\u30c8\u3068\u3001\u7de8\u96c6\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u81ea\u4f53\u306fblob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066.git\/objects\u4ee5\u4e0b\u306b\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">.git\/refs\/stash\u304c\u4f5c\u6210\u3055\u308c\u308b<\/ul>\n<pre class=\"post-pre\"><code>\u53c2\u7167\u3059\u308bcommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(\u6700\u65b0\u306estash)\r\n<\/code><\/pre>\n<h6>\u786e\u8ba4\u4e00\u4e0b.git\/refs\/stash\u4e2d\u8bb0\u5f55\u7684\u54c8\u5e0c\u503c\u662f\u4ec0\u4e48\u3002<\/h6>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git cat-file <span class=\"nt\">-p<\/span> .git\/refs\/stash\u3067\u53c2\u7167\u3055\u308c\u3066\u3044\u308b\u30cf\u30c3\u30b7\u30e5<span class=\"o\">(<\/span>40\u6841<span class=\"o\">)<\/span>\r\n<span class=\"go\">\r\ntree tree\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\nparent \u89aacommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c81\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\nparent \u89aacommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c82\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\n<\/span><span class=\"gp\">author \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span> UNIX\u6642\u9593 +0900\r\n<span class=\"gp\">committer \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span> UNIX\u6642\u9593 +0900\r\n<span class=\"go\">\r\nWIP on \u30d6\u30e9\u30f3\u30c1\u540d: \u30cf\u30c3\u30b7\u30e57\u6841 \u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/span><\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u51fa\u8fd9\u662f\u4e00\u4e2a\u5177\u6709\u6700\u65b0commit\u548c\u53e6\u4e00\u4e2acommit\u4e3a\u7236\u7684commit\u5bf9\u8c61\u3002<\/p>\n<h6>\u8bf7\u786e\u8ba4\u53e6\u4e00\u4e2a\u5bb6\u957f\u3002<\/h6>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git cat-file <span class=\"nt\">-p<\/span> commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c81\u306e\u30cf\u30c3\u30b7\u30e5<span class=\"o\">(<\/span>40\u6841 or 7\u6841<span class=\"o\">)<\/span> \r\n<span class=\"go\">\r\ntree tree\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\nparent \u89aacommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c81\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\n<\/span><span class=\"gp\">author \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span> UNIX\u6642\u9593 +0900\r\n<span class=\"gp\">committer \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span> UNIX\u6642\u9593 +0900\r\n<span class=\"go\"> \r\nindex on \u30d6\u30e9\u30f3\u30c1\u540d: \u30cf\u30c3\u30b7\u30e57\u6841 \u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/span><\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u51fa\u8fd9\u4e2acommit\u5bf9\u8c61\u4e5f\u6709\u6700\u65b0\u7684commit\u5bf9\u8c61\u4f5c\u4e3a\u5176\u7236\u8282\u70b9\u3002<\/p>\n<div>\n<div class=\"post-table\">commit\u542b\u3080\u5185\u5bb9\u89aa\u304c1\u3064\u306ecommit\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u6642\u70b9\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u542b\u3080\u89aa\u304c2\u3064\u306ecommit\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u6642\u70b9\u306e\u30d5\u30a1\u30a4\u30eb\u3001\u3001\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u306e\u5909\u66f4\u4e21\u65b9\u3092\u542b\u3080<\/div>\n<\/div>\n<h6>\u5982\u679c\u6709\u591a\u4e2a\u9690\u85cf\u7684\u5730\u65b9<\/h6>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">.git\/refs\/stash\u306b\u306f\u6700\u65b0\u306estash\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3057\u304b\u4fdd\u5b58\u3055\u308c\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">stash\u306e\u4e00\u89a7\u306f.git\/logs\/refs\/stash\u306b\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">.git\/logs\/refs\/stash\u306b\u3059\u3079\u3066\u306estash\u306e\u60c5\u5831\u304c\u66f8\u304d\u8db3\u3055\u308c\u3066\u3044\u304f<\/ul>\n<pre class=\"post-pre\"><code>0000000000000000000000000000000000000000 commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; UNIX\u6642\u9593 +0900\tWIP on \u30d6\u30e9\u30f3\u30c1\u540d: stash\u3057\u305f\u6642\u306eHEAD\u306ecommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(7\u6841)  stash\u3057\u305f\u6642\u306eHEAD\u306ecommit\u306e\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\ncommit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; UNIX\u6642\u9593 +0900\tWIP on \u30d6\u30e9\u30f3\u30c1\u540d: stash\u3057\u305f\u6642\u306eHEAD\u306ecommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(7\u6841)  stash\u3057\u305f\u6642\u306eHEAD\u306ecommit\u306e\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/reflog\u306e\u6700\u65b0\u306b\u5c65\u6b74\u304c\u8ffd\u52a0\u3055\u308c\u308b\r\n<\/span><span class=\"gp\">$<\/span> git reflog \r\n\r\n<span class=\"gp\">xxxxxxx (HEAD -&gt;<\/span> \u30d6\u30e9\u30f3\u30c1\u540d<span class=\"o\">)<\/span> HEAD@<span class=\"o\">{<\/span>n<span class=\"o\">}<\/span>: reset: moving to HEAD\r\n<\/code><\/pre>\n<h4>\u786e\u8ba4\u5df2\u64a4\u9000\u4e4b\u7269<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u907f\u96e3\u3057\u305f\u4f5c\u696d\u306e\u4e00\u89a7\u3092\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git stash list \r\n<span class=\"go\"> \r\n\/\/git stash list\u3068git diff\u306e\u5408\u308f\u305b\u6280\r\n<\/span><span class=\"gp\">$<\/span> git stash list <span class=\"nt\">-p<\/span>\r\n<span class=\"go\"> \r\n\/\/stash\u5c65\u6b74\u8a73\u7d30\r\n<\/span><span class=\"gp\">$<\/span> git stash show\r\n<span class=\"go\">\r\n\/\/N\u756a\u76ee\u306b\u30b9\u30bf\u30c3\u30b7\u30e5\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u4e00\u89a7\u3092\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git stash show stash@<span class=\"o\">{<\/span>n<span class=\"o\">}<\/span>\r\n<span class=\"go\">\u3000\r\n\/\/N\u756a\u76ee\u306b\u30b9\u30bf\u30c3\u30b7\u30e5\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u5dee\u5206\u3092\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git stash show <span class=\"nt\">-p<\/span> stash@<span class=\"o\">{<\/span>n<span class=\"o\">}<\/span>\r\n<\/code><\/pre>\n<div>\n<div class=\"post-table\">stash\u6d88\u3059\u6d88\u3055\u306a\u3044\u5fa9\u5143\u3059\u308bpopapply\u5fa9\u5143\u3057\u306a\u3044drop-<\/div>\n<\/div>\n<h4>\u5c06\u5df2\u64a4\u79bb\u7684\u4e8b\u7269\u6062\u590d<\/h4>\n<p>\u6211\u5c06\u6062\u590d\u5b58\u50a8\u7684\u6587\u4ef6\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3082\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u3082\u623b\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u5225\u30d6\u30e9\u30f3\u30c1\u3067\u5fa9\u5143\u3059\u308b\u3068\u30de\u30fc\u30b8\u3055\u308c\u308b\u304c\u3001\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u304c\u8d77\u3053\u308b\u5834\u5408\u3082\u3042\u308b<\/ul>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u6700\u65b0\u306e\u4f5c\u696d\u3092\u5fa9\u5143\r\n<\/span><span class=\"gp\">$<\/span> git stash apply \r\n<span class=\"gp\">$<\/span> git stash apply <span class=\"nt\">--index<\/span>\r\n<span class=\"go\"> \r\n\/\/\u7279\u5b9a\u306e\u4f5c\u696d\u3092\u5fa9\u5143\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git stash apply \u30b9\u30bf\u30c3\u30b7\u30e5\u540d \r\n<span class=\"gp\">$<\/span> git stash apply stash@<span class=\"o\">{<\/span>n<span class=\"o\">}<\/span> \r\n<span class=\"go\"> \r\n\/\/\u6700\u65b0\u304b\u3089n\u756a\u76ee\u306e\u4f5c\u696d\u3092\u623b\u3059\r\n<\/span><span class=\"gp\">$<\/span> git stash apply n\r\n<span class=\"go\"> \r\n\/\/\u9000\u907f\u3057\u305f\u4e2d\u306e\u6700\u65b0\u306e\u4f5c\u696d\u3092\u5fa9\u5143\u3059\u308b(\u623b\u3057\u305f\u5185\u5bb9\u306f\u9000\u907f\u30ea\u30b9\u30c8\u304b\u3089\u524a\u9664)\r\n<\/span><span class=\"gp\">$<\/span> git stash pop\r\n<\/code><\/pre>\n<h4>\u5220\u9664\u5df2\u64a4\u56de\u7684\u5185\u5bb9<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u907f\u96e3\u3057\u305f\u4e2d\u306e\u6700\u65b0\u306e\u4f5c\u696d\u3092\u524a\u9664\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git stash drop \r\n<span class=\"go\"> \r\n\/\/\u7279\u5b9a\u306e\u907f\u96e3\u3057\u305f\u4f5c\u696d\u3092\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git stash drop \u30b9\u30bf\u30c3\u30b7\u30e5\u540d \r\n<span class=\"gp\">$<\/span> git stash drop stash@<span class=\"o\">{<\/span>n<span class=\"o\">}<\/span>\r\n<span class=\"go\"> \r\n\/\/\u6700\u65b0\u304b\u30892\u756a\u76ee\u306e\u3082\u306e\u3092\u524a\u9664\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git stash drop 2\r\n<span class=\"go\">\r\n\/\/\u907f\u96e3\u3057\u305f\u4f5c\u696d\u3059\u3079\u3066\u3092\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git stash clear \r\n<\/code><\/pre>\n<h5>\u5728.git\u4e2d\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u6700\u65b0\u306estash\u3092\u524a\u9664\u3059\u308b\u3068\u3001.git\/refs\/stash\u306e\u30cf\u30c3\u30b7\u30e5\u304c\u3001\u305d\u306e\u6b21\u306b\u65b0\u3057\u3044\u3082\u306e\u306b\u66f8\u304d\u63db\u308f\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">.git\/logs\/refs\/stash\u304b\u3089\u3001\u524a\u9664\u3057\u305fstash\u304c\u6d88\u3048\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">stash\u3092\u3059\u3079\u3066\u6d88\u3059\u3068.git\/refs\/stash\u3068.git\/logs\/refs\/stash\u304c\u524a\u9664\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u524a\u9664\u3057\u305fstash\u306ecommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u305d\u306e\u307e\u307e\u6b8b\u308b<\/ul>\n<h4>\u5728\u5220\u9664\u5206\u652f\u4e4b\u524d\uff0c\u5982\u679c\u5df2\u7ecf\u5bf9\u6587\u4ef6\u8fdb\u884c\u4e86\u7f16\u8f91\uff0c\u5e94\u8be5\u5982\u4f55\u5904\u7406\u3002<\/h4>\n<p>\u4f7f\u7528git stash\u547d\u4ee4\u5c06\u6240\u505a\u7684\u66f4\u6539\u6682\u5b58\u8d77\u6765\uff0c\u7136\u540e\u521b\u5efa\u5e76\u5207\u6362\u5230\u4e00\u4e2a\u65b0\u7684\u5206\u652f\uff0c\u518d\u4f7f\u7528git stash pop\u547d\u4ee4\u6062\u590d\u4e4b\u524d\u6682\u5b58\u7684\u66f4\u6539\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u524d\u56de\u306e\u30b3\u30df\u30c3\u30c8\u4ee5\u964d\u306e\u64cd\u4f5c\u3092\u9000\u907f\r\n<\/span><span class=\"gp\">$<\/span> git stash\r\n<span class=\"go\">\r\n\/\/\u30d6\u30e9\u30f3\u30c1\u3092\u4f5c\u6210\u3057\u3066\u5207\u308a\u66ff\u3048\r\n<\/span><span class=\"gp\">$<\/span> git switch <span class=\"nt\">-c<\/span> \u65b0\u898f\u4f5c\u6210\u3059\u308b\u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/\u9000\u907f\u3057\u305f\u64cd\u4f5c\u3092\u518d\u53cd\u6620\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git stash pop\r\n<\/code><\/pre>\n<h2>2. Git\u7684\u64cd\u4f5c\u53ca.git\/\u6587\u4ef6\u5939\u5185\u7684\u53d8\u5316<\/h2>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/248-0.png\" alt=\"2-0.png\" \/><\/div>\n<div>\n<div class=\"post-table\">\u540d\u524d\u7279\u5fb4\u5bfe\u8c61\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u5b9f\u969b\u306b\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u4f5c\u696d\u3092\u3059\u308b\u5834\u6240.git\u306e\u5916\u306e\u5b9f\u30d5\u30a1\u30a4\u30eb(.gitignore\u306a\u3069\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306f\u9664\u304f)\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u30a8\u30ea\u30a2.git\u304c\u8ffd\u8de1\u4e2d\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u767b\u9332\u3055\u308c\u308b\u5834\u6240(\u30d5\u30a1\u30a4\u30eb\u306f\u6700\u5f8c\u306b\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3055\u308c\u305f\u6642\u70b9\u306e\u72b6\u614b).git\/index(add\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306fblob\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066.git\/objects\/\u5185)\u30ed\u30fc\u30ab\u30eb\u30ea\u30dd\u30b8\u30c8\u30ea\u5909\u66f4\u306e\u5c65\u6b74\u3092\u8a18\u9332\u3057\u3066\u3044\u308b\u5834\u6240.git\/\u5185<\/div>\n<\/div>\n<div>\n<div class=\"post-table\">\u7528\u8a9eGit\u30b3\u30de\u30f3\u30c9\u610f\u5473\u5185\u90e8\u7684\u306a\u52d5\u4f5c\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0git add\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u3067\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u60c5\u5831\u3092\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u30a8\u30ea\u30a2\u306b\u9001\u308b\u3053\u3068blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u751f\u6210\u3001.git\/index\u306e\u66f4\u65b0\u306a\u3069\u30b3\u30df\u30c3\u30c8git commit\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u30a8\u30ea\u30a2\u306b\u96c6\u3081\u3089\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u3092\u30ed\u30fc\u30ab\u30eb\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u8a18\u9332\u3059\u308b\u3053\u3068commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3001tree\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u751f\u6210\u3001HEAD\u306e\u79fb\u52d5\u306a\u3069<\/div>\n<\/div>\n<h3>2-1. \u9636\u6bb5\u8bbe\u5907<\/h3>\n<h4>\u521b\u5efa\u6587\u4ef6<\/h4>\n<h5>\u4f7f\u7528Git<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\r\n<\/span><span class=\"gp\">$<\/span> <span class=\"nb\">touch <\/span>test.txt\r\n<\/code><\/pre>\n<h5>\u5728.git\u4e2d\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<p>\u6b64\u65f6\uff0c\u5728.git\u6587\u4ef6\u5939\u5185\u6ca1\u6709\u4efb\u4f55\u53d8\u52a8\u3002<\/p>\n<h4>\u7f16\u8f91\u6587\u4ef6<\/h4>\n<h5>Git\u64cd\u4f5c (Git operations)<\/h5>\n<p>\u5728\u8fd9\u4e00\u70b9\u4e0a\uff0c.git\u76ee\u5f55\u5185\u6ca1\u6709\u4efb\u4f55\u6d3b\u52a8\u3002<\/p>\n<h4>\u821e\u53f0\u5e03\u7f6e<\/h4>\n<h5>Git\u7684\u64cd\u4f5c<\/h5>\n<p>\u5728\u8fdb\u884c\u5206\u9636\u6bb5\u4e4b\u524d\uff0c\u8bf7\u786e\u8ba4\u5f53\u524d\u5df2\u7d22\u5f15\u7684\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u73fe\u5728\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\r\n<\/span><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<span class=\"go\">\r\n\/\/.git\/index\u304c\u6301\u3063\u3066\u3044\u308b\u60c5\u5831\u5168\u90e8\u3092\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span> <span class=\"nt\">--debug<\/span>\t\r\n<\/code><\/pre>\n<p>\u5c06\u5148\u524d\u521b\u5efa\u7684text.txt\u6587\u4ef6\u8fdb\u884c\u6682\u5b58\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git add test.txt\r\n<\/code><\/pre>\n<h5>\u5728.git\u4e2d\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<p>\u521b\u5efa\u4e86\u4e00\u4e2a blob \u5bf9\u8c61\u7684\u6587\u4ef6\u3002<br \/>\n\uff08\u7531\u4e8e\u662f\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u76f4\u63a5\u5728\u7f16\u8f91\u5668\u4e2d\u6253\u5f00\u4f1a\u51fa\u73b0\u4e71\u7801\u3002\uff09<\/p>\n<pre class=\"post-pre\"><code>xK\ufffd\ufffdOR0`\r\n<\/code><\/pre>\n<p>\u4f7f\u7528cat-file\u547d\u4ee4\u786e\u8ba4\u6587\u4ef6\u7684\u5185\u5bb9\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\"> $<\/span> git cat-file <span class=\"nt\">-p<\/span> \u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\"> \r\n (\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u8eab)\r\n \u203b\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u8eab\u304c\u7a7a\u3060\u3068\u4f55\u3082\u8868\u793a\u3055\u308c\u306a\u3044\r\n<\/span><\/code><\/pre>\n<p>index\u6587\u4ef6\u7684\u5185\u5bb9\u5c06\u88ab\u66f4\u65b0\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<\/code><\/pre>\n<h4>\u5176\u4ed6\u7684\u5206\u6bb5<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u90e8\u5206\u3054\u3068\u306b\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\r\n<\/span><span class=\"gp\">$<\/span> git add <span class=\"nt\">-p<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/\u5909\u66f4\u304c\u3042\u3063\u305f\u3059\u3079\u3066\u306e\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u306e\u5909\u66f4\u3092\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u306b\u52a0\u3048\u308b\r\n<\/span><span class=\"gp\">$<\/span> git add <span class=\"nb\">.<\/span>\t\r\n<span class=\"go\">\r\n\/\/\u5909\u66f4\u304c\u3042\u3063\u305f\u8ffd\u8de1\u4e2d\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u306e\u5909\u66f4\u3092\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u306b\u52a0\u3048\u308b\r\n<\/span><span class=\"gp\">$<\/span> git add <span class=\"nt\">-u<\/span>\t\r\n<\/code><\/pre>\n<h4>\u786e\u8ba4\u5df2\u7ecf\u7d22\u5f15\u7684\u6587\u4ef6<\/h4>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<span class=\"go\">\r\n\/\/.git\/index\u304c\u6301\u3063\u3066\u3044\u308b\u60c5\u5831\u5168\u90e8\u3092\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span> <span class=\"nt\">--debug<\/span>\r\n<\/code><\/pre>\n<h4>\u53d6\u6d88\u6587\u4ef6\u7684\u6682\u5b58<\/h4>\n<p>\u4e0d\u4f1a\u5f71\u54cd\u5de5\u4f5c\u533a\u3002<\/p>\n<h5>Git\u64cd\u4f5c\u6307\u4f7f\u7528Git\u5de5\u5177\u8fdb\u884c\u7248\u672c\u63a7\u5236\u548c\u534f\u4f5c\u7684\u8fc7\u7a0b\u3002<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/add\u524d\u306b\u623b\u3059\r\n<\/span><span class=\"gp\">$<\/span> git restore <span class=\"nt\">--staged<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"gp\">$<\/span> git restore <span class=\"nt\">-S<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u5939\u4e2d\u53d1\u751f\u7684\u4e8b\u4ef6\u3002<\/h5>\n<ul class=\"post-ul\">.git\/index\u304c\u66f4\u65b0\u3055\u308c\u308b<\/ul>\n<h4>\u4e0d\u8ffd\u8e2a<\/h4>\n<p>\u5de5\u4f5c\u533a\u7684\u6587\u4ef6\u4fdd\u6301\u539f\u6837\u3002<\/p>\n<h5>Git\u64cd\u4f5c can be paraphrased as \u201cGit\u7684\u4f7f\u7528\u201d in Chinese.<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304b\u3089\u5916\u3059\r\n<\/span><span class=\"gp\">$<\/span> git <span class=\"nb\">rm<\/span> <span class=\"nt\">--cached<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/\u30b3\u30df\u30c3\u30c8\u3057\u3066\u30ed\u30fc\u30ab\u30eb\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git commit <span class=\"nt\">-m<\/span> <span class=\"s2\">\"\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\"<\/span>\r\n<\/code><\/pre>\n<h5>\u5728 .git \u6587\u4ef6\u5185\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<ul class=\"post-ul\">.git\/index\u304c\u66f4\u65b0\u3055\u308c\u308b<\/ul>\n<pre class=\"post-pre\"><code><span class=\"gp\"> $<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<span class=\"gp\"> $<\/span> git ls-files <span class=\"nt\">-s<\/span>\r\n<span class=\"go\"> \r\n \u30d5\u30a1\u30a4\u30eb\u306e\u7a2e\u985e\u3068\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3 blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u30d5\u30e9\u30b0\t\u30d1\u30b9\/\u30d5\u30a1\u30a4\u30eb\u540d\r\n \u30d5\u30a1\u30a4\u30eb\u306e\u7a2e\u985e\u3068\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3 blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u30d5\u30e9\u30b0\t\u30d1\u30b9\/\u30d5\u30a1\u30a4\u30eb\u540d\r\n \u30d5\u30a1\u30a4\u30eb\u306e\u7a2e\u985e\u3068\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3 blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u30d5\u30e9\u30b0\t\u30d1\u30b9\/\u30d5\u30a1\u30a4\u30eb\u540d\r\n \u30d5\u30a1\u30a4\u30eb\u306e\u7a2e\u985e\u3068\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3 blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u30d5\u30e9\u30b0\t\u30d1\u30b9\/\u30d5\u30a1\u30a4\u30eb\u540d\u3000\r\n<\/span><\/code><\/pre>\n<h3>2-2. \u627f\u8bfa<\/h3>\n<h4>\u72af\u4e0b<\/h4>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/292-0.png\" alt=\"2-2-1.png\" \/><\/div>\n<h5>Git\u64cd\u4f5c is Git\u7684\u4f7f\u7528\u65b9\u6cd5.<\/h5>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git commit <span class=\"nt\">-m<\/span> <span class=\"s2\">\"\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\"<\/span>\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u5939\u5185\u53d1\u751f\u7684\u4e8b\u4ef6<\/h5>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4f5c\u6210\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">tree\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4f5c\u6210\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30d6\u30e9\u30f3\u30c1\u540d\u306e\u6307\u3059commit\u304c\u5909\u308f\u308b\u306e\u3067.git\/refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\u306e\u30cf\u30c3\u30b7\u30e5\u304c\u66f4\u65b0\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">.git\/logs\/HEAD\u306b\u30ed\u30b0\u304c\u8ffd\u52a0\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">.git\/COMMIT_EDITMSG\u306b\u5148\u7a0b\u306e\u30b3\u30df\u30c3\u30c8\u6642\u306e\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u66f8\u304d\u8fbc\u307e\u308c\u308b(\u6700\u5f8c\u306e\u3082\u306e\u306e\u307f)<\/ul>\n<pre class=\"post-pre\"><code>\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/code><\/pre>\n<ul class=\"post-ul\">branch\u304c\u65b0\u3057\u304f\u4f5c\u6210\u3055\u308c\u305fcommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53c2\u7167\u3059\u308b\u3088\u3046\u306b\u306a\u308b<\/ul>\n<pre class=\"post-pre\"><code>\u65b0\u3057\u304f\u4f5c\u6210\u3055\u308c\u305fcommit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<ul class=\"post-ul\">.git\/logs\/HEAD\u306b\u5c65\u6b74\u304c\u8ffd\u8a18\u3055\u308c\u308b<\/ul>\n<pre class=\"post-pre\"><code>\u3000commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; UNIX\u6642\u9593 +0900\tcommit (initial): \u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n\r\n<\/code><\/pre>\n<ul class=\"post-ul\">.git\/logs\/refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\u306b\u5c65\u6b74\u304c\u8ffd\u8a18\u3055\u308c\u308b<\/ul>\n<pre class=\"post-pre\"><code>commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; UNIX\u6642\u9593 +0900\tcommit (initial): \u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/code><\/pre>\n<h5>\u67e5\u770b\u6b64\u65f6\u70b9\u7684git log.<\/h5>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git log\r\n<span class=\"gp\">commit \u30cf\u30c3\u30b7\u30e5(40\u6841) (HEAD -&gt;<\/span> \u30d6\u30e9\u30f3\u30c1\u540d<span class=\"o\">)<\/span>\r\n<span class=\"gp\">Author: \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span>\r\n<span class=\"go\">Date:   \u66dc\u65e5 \u6708 \u65e5 \u6642:\u5206:\u79d2 \u5e74 +0900\r\n\r\n    \u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/span><\/code><\/pre>\n<h5>\u786e\u8ba4\u6b64\u65f6\u7684\u5206\u671f\u8fdb\u884c\u60c5\u51b5<\/h5>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<span class=\"go\">100644 blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) 0       test.txt\r\n<\/span><\/code><\/pre>\n<h5>\u786e\u8ba4\u5bf9\u8c61\u7684\u7c7b\u578b<\/h5>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git cat-file <span class=\"nt\">-t<\/span>\r\n<span class=\"go\">\r\nblob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\n<\/span><\/code><\/pre>\n<p>\u65e0\u8bba\u662f tree \u8fd8\u662f blob\uff0c\u5728\u4e0d\u540c\u7684 commit \u4e2d\uff0c\u5bf9\u4e8e\u6ca1\u6709\u66f4\u6539\u7684\u6587\u4ef6\uff0c\u5b83\u4eec\u7684\u54c8\u5e0c\u503c\u90fd\u662f\u76f8\u540c\u7684\uff0c\u6240\u4ee5\u5bf9\u8c61\u6587\u4ef6\u4e0d\u4f1a\u589e\u52a0\u3002\u53cd\u8fc7\u6765\u8bf4\uff0c\u5982\u679c\u5bf9\u66f4\u6539\u8fdb\u884c\u6682\u5b58\uff0c\u5b83\u4eec\u4f1a\u4e0d\u65ad\u589e\u52a0\u3002<\/p>\n<ul class=\"post-ul\">.git\/refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\u306b\u683c\u7d0d\u3055\u308c\u308b\u30cf\u30c3\u30b7\u30e5\u304c\u65b0\u3057\u3044commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u3082\u306e\u306b\u66f8\u304d\u63db\u308f\u308b<\/ul>\n<h4>\u63d0\u4ea4\u8986\u76d6<\/h4>\n<p>\u5728\u5185\u90e8\uff0c\u4e0d\u662f\u8986\u76d6\uff0c\u800c\u662f\u521b\u5efa\u4e86\u4e00\u4e2a\u5177\u6709\u76f8\u540c\u7236\u63d0\u4ea4\u7684\u65b0\u63d0\u4ea4\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/314-0.png\" alt=\"2-2-2.png\" \/><\/div>\n<h5>Git\u7684\u4f7f\u7528<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u524d\u306ecommit\u306b\u8ffd\u52a0\u3057\u305f\u3044\u5909\u66f4\u3092\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git add \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/commit\u306e\u4e0a\u66f8\u304d(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u6307\u5b9a\u306a\u3057)\r\n<\/span><span class=\"gp\">$<\/span> git commit <span class=\"nt\">--amend<\/span>\r\n<span class=\"go\"> \r\n\/\/commit\u306e\u4e0a\u66f8\u304d(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u6307\u5b9a\u3042\u308a)\r\n<\/span><span class=\"gp\">$<\/span> git commit <span class=\"nt\">--amend<\/span> <span class=\"nt\">-m<\/span> <span class=\"s2\">\"\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\"<\/span>\r\n<\/code><\/pre>\n<p>\u82e5\u672a\u6307\u5b9a\u63d0\u4ea4\u4fe1\u606f\uff0c\u5219\u6253\u5f00COMMIT_EDITMSG\u6587\u4ef6\u8fdb\u884c\u7f16\u8f91\u540e\u4fdd\u5b58\u5e76\u5173\u95ed\u3002<\/p>\n<h4>\u786e\u8ba4\u63d0\u4ea4\u8bb0\u5f55<\/h4>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git log\r\n<\/code><\/pre>\n<p>\u7531\u4e8ecommit\u7684\u54c8\u5e0c\u503c\u53d1\u751f\u4e86\u53d8\u5316\uff0c\u6211\u4eec\u53ef\u4ee5\u77e5\u9053\u53e6\u4e00\u4e2acommit\u5bf9\u8c61\u5df2\u7ecf\u88ab\u521b\u5efa\u3002<br \/>\n\u539f\u6709\u7684commit\u5728\u88ab\u8986\u76d6\u4e4b\u524d\u4ecd\u7136\u5b58\u5728\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u54c8\u5e0c\u503c\u8fdb\u884c\u786e\u8ba4\u3002<\/p>\n<h3>2-3. \u6307\u5b9acommit\u7684\u65b9\u6cd5<\/h3>\n<h4>\u4f7f\u7528\u5206\u652f\u540d\u79f0\u8fdb\u884c\u6307\u5b9a<\/h4>\n<p>\u53ef\u4ee5\u6307\u5b9a\u8be5\u5206\u652f\u6240\u6307\u5411\u7684commit\u3002<\/p>\n<h4>\u4ee5 commit \u7684\u54c8\u5e0c\u503c\u6307\u5b9a<\/h4>\n<div>\n<div class=\"post-table\">\u6841\u6570\u8aac\u660e7\u6841commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\u306e\u6700\u521d\u306e7\u6841\u3067\u6307\u5b9a\u3059\u308b40\u6841commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\u306e\u6700\u521d\u306e40\u6841\u3067\u6307\u5b9a\u3059\u308b<\/div>\n<\/div>\n<h4>\u4f7f\u7528HEAD\u7684\u76f8\u5bf9\u5173\u7cfb\u6765\u6307\u5b9a<\/h4>\n<p>\u5f53\u5b58\u5728\u591a\u4e2a\u7236\u6bcd\u65f6\uff0c\u5c06\u9009\u62e9\u9996\u4f4d\u7684\u7236\u6bcd\u3002<\/p>\n<div>\n<div class=\"post-table\">\u3069\u306ecommit\u3092\u6307\u3059\u304b~^~n~^~n\u73fe\u5728\u306eHEAD\u304c\u6307\u3059commitHEADHEADHEAD@@@\u73fe\u5728\u306eHEAD\u304b\u30891\u3064\u524d\u306ecommitHEAD~HEAD^HEAD~1(1\u306f\u7701\u7565\u53ef\u80fd)@~@^@~1(1\u306f\u7701\u7565\u53ef\u80fd)\u73fe\u5728\u306eHEAD\u304b\u30892\u3064\u524d\u306ecommitHEAD~~HEAD^^HEAD~2@~~@^^@~2\u73fe\u5728\u306eHEAD\u304b\u30893\u3064\u524d\u306ecommitHEAD~~~HEAD^^^HEAD~3@~~~@^^@~3<\/div>\n<\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/329-0.png\" alt=\"2-3-1.png\" \/><\/div>\n<h4>\u5f53\u6709\u591a\u4e2a\u7236\u6bcd\u65f6\uff0c\u9009\u62e9\u7236\u6bcd<\/h4>\n<div>\n<div class=\"post-table\">\u3069\u306ecommit\u3092\u6307\u3059\u304b^n\u73fe\u5728\u306eHEAD\u306e2\u756a\u76ee\u306e\u89aaHEAD^2\u73fe\u5728\u306eHEAD\u306e3\u756a\u76ee\u306e\u89aaHEAD^3<\/div>\n<\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/332-0.png\" alt=\"2-3-2.png\" \/><\/div>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u89aa\u304c3\u3064\u306b\u306a\u308b\u4f8b\r\n\/\/untracked\u30d5\u30a1\u30a4\u30eb\u3082\u542b\u3081\u305fgit stash\r\n<\/span><span class=\"gp\">$<\/span> git stash <span class=\"nt\">-u<\/span>\r\n<span class=\"gp\">$<\/span> git stash <span class=\"nt\">-a<\/span>\r\n<span class=\"go\">\r\n\/\/\u89aa\u304c3\u3064\u4ee5\u4e0a\u306b\u306a\u308b\u4f8b\r\n\/\/octopus\u30de\u30fc\u30b8 \u73fe\u5728\u306e\u30d6\u30e9\u30f3\u30c1\u306b2\u3064\u4ee5\u4e0a\u306e\u30d6\u30e9\u30f3\u30c1\u3092\u30de\u30fc\u30b8\r\n<\/span><span class=\"gp\">$<\/span> git merge <span class=\"nt\">--strategy<\/span><span class=\"o\">=<\/span>octopus \u30d6\u30e9\u30f3\u30c1\u540d1 \u30d6\u30e9\u30f3\u30c1\u540d2 \u30d6\u30e9\u30f3\u30c1\u540d3 ...\r\n<\/code><\/pre>\n<h4>\u7528\u7b26\u53f7\u53c2\u8003\u8fdb\u884c\u6307\u5b9a<\/h4>\n<div>\n<div class=\"post-table\">commit\u306e\u6307\u5b9a\u8a18\u8f09\u5834\u6240ORIG_HEAD.git\/ORIG_HEAD\u306b\u8a18\u9332\u3055\u308c\u3066\u3044\u308bcommitFETCH_HEAD.git\/FETCH_HEAD\u306b\u8a18\u9332\u3055\u308c\u3066\u3044\u308bcommitCHERRY_PICK_HEAD.git\/CHERRY_PICK_HEAD\u306b\u8a18\u9332\u3055\u308c\u3066\u3044\u308bcommitREBASE_HEAD.git\/REBASE_HEAD\u306b\u8a18\u9332\u3055\u308c\u3066\u3044\u308bcommitMERGE_HEAD.git\/MERGE_HEAD\u306b\u8a18\u9332\u3055\u308c\u3066\u3044\u308bcommit<\/div>\n<\/div>\n<h3>2-4. \u8fdc\u7a0b\u4ed3\u5e93<\/h3>\n<p>\u8fd9\u662f\u4e00\u4e2a\u7528\u6765\u8fdb\u884c\u591a\u4eba\u5f00\u53d1\u7684\u5728\u7ebf\u4ed3\u5e93\uff0c\u60a8\u53ef\u4ee5\u5728\u5176\u4e2d\u83b7\u53d6\u5176\u4ed6\u4eba\u7684\u6210\u679c\u5e76\u5171\u4eab\u81ea\u5df1\u7684\u6210\u679c\uff0c\u4ee5\u63a8\u52a8\u5f00\u53d1\u7684\u8fdb\u884c\u3002<\/p>\n<h4>\u5206\u884c\u7684\u79cd\u7c7b<\/h4>\n<div>\n<div class=\"post-table\">\u30d6\u30e9\u30f3\u30c1\u306e\u7a2e\u985e\u8aac\u660e\u4e0a\u6d41\u30d6\u30e9\u30f3\u30c1\u30ed\u30fc\u30ab\u30eb\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u3042\u308b\u3001\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u30d6\u30e9\u30f3\u30c1\u3092\u8ffd\u8de1\u3059\u308bbranch<br \/>\ngit fetch\u3084git pull\u304c\u6210\u529f\u3059\u308b\u3068\u66f4\u65b0\u3055\u308c\u308b<br \/>\n\u5b9f\u4f53\u306f.git\/refs\/remotes\/\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1branch\u306e\u6307\u5b9a\u306a\u3057\u3067 git merge\u3057\u305f\u3068\u304d\u306b\u30de\u30fc\u30b8\u5bfe\u8c61\u306b\u306a\u308bbranch<\/div>\n<\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/340-0.png\" alt=\"2-1-3.png\" \/><\/div>\n<h4>\u6ce8\u518c\u3001\u5220\u9664\u8fdc\u7a0b\u4ed3\u5e93<\/h4>\n<p>\u5728\u672c\u5730\u5b58\u50a8\u5e93\u4e2d\u8fdb\u884c\u8fdc\u7a0b\u5b58\u50a8\u5e93\u7684\u6ce8\u518c\u548c\u5220\u9664\u3002<\/p>\n<h5>Git\u7684\u4f7f\u7528\u65b9\u6cd5<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u8ffd\u52a0\u524d\u306e\u78ba\u8a8d\r\n\/\/\u30ea\u30e2\u30fc\u30c8\u540d\u3068\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u4e00\u89a7\u3092\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git remote <span class=\"nt\">-v<\/span> \t\r\n<span class=\"go\">\r\n\/\/\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u30ea\u30e2\u30fc\u30c8\u540d\u3092\u3064\u3051\u3066\u767b\u9332\r\n<\/span><span class=\"gp\">$<\/span> git remote add \u30ea\u30e2\u30fc\u30c8\u540d \u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u306eurl\r\n<span class=\"go\">\r\n\/\/\u8ffd\u52a0\u5f8c\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git remote <span class=\"nt\">-v<\/span> \t\r\n<span class=\"go\"> \r\n\/\/\u30ea\u30e2\u30fc\u30c8\u306e\u767b\u9332\u3092\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git remote <span class=\"nb\">rm <\/span>\u30ea\u30e2\u30fc\u30c8\u540d\r\n<span class=\"go\"> \r\n\/\/\u524a\u9664\u5f8c\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git remote <span class=\"nt\">-v<\/span>\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u5939\u5185\u53d1\u751f\u7684\u4e8b\u60c5\u3002<\/h5>\n<p>\u5f53\u4f7f\u7528git remote add\u547d\u4ee4\u6dfb\u52a0\u8fdc\u7a0b\u4ed3\u5e93\u65f6\uff0c\u4f1a\u9644\u52a0\u4e0b\u5217\u5185\u5bb9\uff1b\u800c\u4f7f\u7528git remote rm\u547d\u4ee4\u5220\u9664\u4ed3\u5e93\u65f6\uff0c\u4f1a\u5c06\u5176\u79fb\u9664\u3002<\/p>\n<pre class=\"post-pre\"><code>[remote \"\u30ea\u30e2\u30fc\u30c8\u540d\"]\r\n\turl = git@github.com:\u30e6\u30fc\u30b6\u30fc\u540d\/\u30ea\u30dd\u30b8\u30c8\u30ea\u540d.git\r\n\tfetch = +refs\/heads\/*:refs\/remotes\/\u30ea\u30e2\u30fc\u30c8\u540d\/*\r\n<\/code><\/pre>\n<h4>\u5176\u4ed6<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ea\u30e2\u30fc\u30c8\u540d\u306e\u5909\u66f4\r\n<\/span><span class=\"gp\">$<\/span> git remote rename \u5909\u66f4\u524d\u306e\u30ea\u30e2\u30fc\u30c8\u540d \u5909\u66f4\u5f8c\u306e\u30ea\u30e2\u30fc\u30c8\u540d\t\r\n<span class=\"go\">\r\n\/\/\u30ea\u30e2\u30fc\u30c8\u306e\u8a73\u7d30\u3092\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git remote show \u30ea\u30e2\u30fc\u30c8\u540d\r\n<\/code><\/pre>\n<h4>\u5c06commit\u53d1\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93<\/h4>\n<h5>Git\u64cd\u4f5c\u53ef\u4ee5\u88ab\u7b80\u5355\u63cf\u8ff0\u4e3a\u7ba1\u7406\u3001\u8ddf\u8e2a\u548c\u534f\u4f5c\u8f6f\u4ef6\u5f00\u53d1\u9879\u76ee\u7684\u4e00\u7cfb\u5217\u5de5\u5177\u548c\u547d\u4ee4\u3002<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u73fe\u5728\u306ebranch\u306e\u5909\u66f4\u3092\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u306b\u53cd\u6620\u3055\u305b\u308b(\u30ea\u30e2\u30fc\u30c8\u3068\u7d10\u3065\u3051\u3067\u304d\u3066\u3044\u308b\u5834\u5408\u306f\u300c\u30ea\u30e2\u30fc\u30c8\u540d \u30d6\u30e9\u30f3\u30c1\u540d\u300d\u7701\u7565\u53ef\u80fd)\r\n<\/span><span class=\"gp\">$<\/span> git push  \u30ea\u30e2\u30fc\u30c8\u540d \u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/\u73fe\u5728\u306ebranch\u306e\u5909\u66f4\u3092\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u306b\u53cd\u6620\u3055\u305b\u308b(\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u3068\u306e\u7d10\u4ed8\u3051\u3082\u3059\u308b)\r\n<\/span><span class=\"gp\">$<\/span> git push <span class=\"nt\">-u<\/span> \u30ea\u30e2\u30fc\u30c8\u540d \u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"gp\">$<\/span> git push <span class=\"nt\">--set-upstream<\/span> \u30ea\u30e2\u30fc\u30c8\u540d \u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/\u73fe\u5728\u306ebranch\u306e\u5909\u66f4\u3092\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u306b\u53cd\u6620\u3055\u305b\u308b(\u5f37\u5236\u7684)\r\n<\/span><span class=\"gp\">$<\/span> git push <span class=\"nt\">--force-with-lease<\/span> <span class=\"nt\">--force-if-include<\/span>\t\r\n<\/code><\/pre>\n<h5>\u5728.git\u4e2d\u53d1\u751f\u7684\u4e8b\u60c5\u3002<\/h5>\n<ul class=\"post-ul\">-u\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u3066\u30ed\u30fc\u30ab\u30eb\u3067\u4f5c\u6210\u3057\u305fbranch\u3092push\u3057\u305f\u5834\u5408<\/ul>\n<pre class=\"post-pre\"><code>[branch \"\u30d6\u30e9\u30f3\u30c1\u540d\"]\r\n\tremote = \u30ea\u30e2\u30fc\u30c8\u540d\r\n\tmerge = refs\/heads\/\u4e0a\u6d41\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<ul class=\"post-ul\">.git\/FETCH_HEAD\u3067push\u3055\u308c\u305fbranch\u304c\u4e00\u756a\u4e0a\u306b\u8868\u793a\u3055\u308c\u308b(\u30e9\u30b0\u3042\u308a)<\/ul>\n<pre class=\"post-pre\"><code>\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\t\tbranch '\u30d6\u30e9\u30f3\u30c1\u540d' of github.com:\u30e6\u30fc\u30b6\u30fc\u540d\/\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u540d\r\n<\/code><\/pre>\n<ul class=\"post-ul\">.git\/logs\/refs\/remotes\/origin\/\u30d6\u30e9\u30f3\u30c1\u540d\u304c\u3001\u305d\u306e\u30d6\u30e9\u30f3\u30c1\u306e\u521d\u3081\u3066\u306epush\u306e\u5834\u5408\u306b\u4f5c\u6210\u3055\u308c\u308b(\u66f4\u65b0\u306e\u5834\u5408\u306f\u4e0b\u306b\u8ffd\u8a18\u3055\u308c\u3066\u3044\u304f)<\/ul>\n<pre class=\"post-pre\"><code>0000000000000000000000000000000000000000 \u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; UNIX\u6642\u9593 +0900\tupdate by push\r\n\r\n<\/code><\/pre>\n<p>\u5982\u679c\u5728.git\/refs\/remotes\/origin\/\u4e2d\u7684\u5206\u652f\u540d\u662f\u8be5\u5206\u652f\u7684\u7b2c\u4e00\u6b21\u63a8\u9001\u7684\u60c5\u51b5\u4e0b\uff0c\u5c31\u4f1a\u521b\u5efa\uff08\u5982\u679c\u63a8\u9001\u662f\u66f4\u65b0\u7684\u8bdd\uff0c\u5c31\u4f1a\u66f4\u65b0\u54c8\u5e0c\u503c\uff09<\/p>\n<pre class=\"post-pre\"><code>\u65b0\u3057\u3044\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<h5>\u5176\u4ed6<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u306e\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git push <span class=\"nt\">--delete<\/span> \u30ea\u30e2\u30fc\u30c8\u540d \u30ea\u30e2\u30fc\u30c8\u306e\u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"gp\">$<\/span> git push <span class=\"nt\">-d<\/span> \u30ea\u30e2\u30fc\u30c8\u540d \u30ea\u30e2\u30fc\u30c8\u306e\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<h4>\u5c06\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6700\u65b0\u4fe1\u606f\u5e26\u5230\u672c\u5730\u4ed3\u5e93\uff08\u8fdc\u7a0b\u8ddf\u8e2a\u5206\u652f\uff09\u3002<\/h4>\n<p>\u8fdc\u7a0b\u8ffd\u8e2a\u5206\u652f\u7684\u4f4d\u7f6e\u4f4d\u4e8e.git\/refs\/remotes\/origin\/\u5206\u652f\u540d\u5904\u3002<\/p>\n<h5>Git \u64cd\u4f5c\u53ef\u4ee5\u8fdb\u884c\u7248\u672c\u63a7\u5236\uff0c\u7528\u6765\u8ffd\u8e2a\u548c\u7ba1\u7406\u4ee3\u7801\u7684\u4fee\u6539\u3002<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u3082\u542b\u3081\u3066\u30ed\u30fc\u30ab\u30eb\u306b\u3042\u308b\u30d6\u30e9\u30f3\u30c1\u8868\u793a\r\n\/\/(\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u306f\u524d\u56defetch\u6642\u306e\u72b6\u614b\u306a\u306e\u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u66f4\u65b0\u3055\u308c\u3066\u3044\u306a\u3044)\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">-a<\/span>\r\n<span class=\"go\">\r\n\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u306fremotes\/origin\/\u30d6\u30e9\u30f3\u30c1\u540d\u306e\u5f62\u3067\u8868\u793a\u3055\u308c\u308b\r\n\r\n\/\/\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u3059\u3079\u3066\u306e\u30d6\u30e9\u30f3\u30c1\u306e\u66f4\u65b0\u5c65\u6b74\u3092\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u306b\u53d6\u308a\u8fbc\u3080\r\n\/\/(\u30ea\u30e2\u30fc\u30c8\u3067\u524a\u9664\u3055\u308c\u3066\u3044\u308b\u30d6\u30e9\u30f3\u30c1\u304c\u3042\u3063\u3066\u3082\u3001\u30ed\u30fc\u30ab\u30eb\u306b\u3042\u308b\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u306f\u6b8b\u3063\u305f\u307e\u307e)\r\n<\/span><span class=\"gp\">$<\/span> git fetch\r\n<span class=\"go\">\r\n\/\/\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u306e\u66f4\u65b0\u60c5\u5831\u3092\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u306b\u53d6\u308a\u8fbc\u3080\r\n<\/span><span class=\"gp\">$<\/span> git fetch \u30ea\u30e2\u30fc\u30c8\u540d \u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/\u30ea\u30e2\u30fc\u30c8\u3067\u524a\u9664\u3055\u308c\u305f\u30d6\u30e9\u30f3\u30c1\u306e\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u3092\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git fetch <span class=\"nt\">--prune<\/span>\r\n<span class=\"gp\">$<\/span> git fetch <span class=\"nt\">-p<\/span>\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u5939\u4e2d\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">git fetch\u3092\u5b9f\u884c\u3059\u308b\u3068.git\/FETCH_HEAD\u306e\u5185\u5bb9\u306b\u3001\u53d6\u5f97\u3057\u305f\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u72b6\u614b\u304c\u53cd\u6620\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">git fetch &#8211;prune\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u30ea\u30e2\u30fc\u30c8\u3067\u524a\u9664\u3055\u308c\u3066\u3044\u305f\u30d6\u30e9\u30f3\u30c1\u306b\u5bfe\u5fdc\u3059\u308b\u4e0b\u8a18\u30d5\u30a1\u30a4\u30eb\u304c\u524a\u9664\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u300c.git\/refs\/remotes\/\u30d6\u30e9\u30f3\u30c1\u540d\u300d<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u300c.git\/logs\/refs\/remotes\/origin\/\u30d6\u30e9\u30f3\u30c1\u540d\u300d<\/ul>\n<h4>\u79fb\u52d5\u5230\u5df2\u83b7\u53d6\u5e76\u68c0\u51fa\u7684\u5206\u652f\u3002<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ea\u30e2\u30fc\u30c8\u540d\u4e0d\u8981\u3067\u3001\u30d6\u30e9\u30f3\u30c1\u540d\u306e\u307f\r\n<\/span><span class=\"gp\">$<\/span> git switch \u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"gp\">$<\/span> git switch <span class=\"nt\">-c<\/span> \u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<ul class=\"post-ul\">.git\/refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\u304c\u4f5c\u6210\u3055\u308c\u308b<\/ul>\n<pre class=\"post-pre\"><code>\u30d6\u30e9\u30f3\u30c1\u306eHEAD\u304c\u6307\u3057\u3066\u3044\u308b\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5 \r\n<\/code><\/pre>\n<ul class=\"post-ul\">.git\/logs\/refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\u304c\u66f4\u65b0\u4f5c\u6210\u3055\u308c\u308b(\u7121\u3044\u5834\u5408\u306f\u4f5c\u6210\u3055\u308c\u308b)<\/ul>\n<pre class=\"post-pre\"><code>0000000000000000000000000000000000000000 \u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; UNIX\u6642\u9593 +0900\tclone: from github.com:\u30e6\u30fc\u30b6\u30fc\u540d\/\u30ea\u30dd\u30b8\u30c8\u30ea\u540d.git\r\n\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; UNIX\u6642\u9593 +0900\tcommit: \u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841) \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt; UNIX\u6642\u9593 +0900\tcommit: \u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/code><\/pre>\n<h5>Git\u64cd\u4f5c\u53ef\u4ee5\u7b80\u5355\u63cf\u8ff0\u4e3a\u4e00\u7ec4\u5728\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u4e2d\u4f7f\u7528\u7684\u547d\u4ee4\u548c\u64cd\u4f5c\u3002<\/h5>\n<p>\u68c0\u67e5\u5206\u652f\u7684\u4e0a\u6e38\u5206\u652f\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git branch <span class=\"nt\">-vv<\/span>\r\n<\/code><\/pre>\n<h5>\u5728.git\u5185\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<p>\u4ec5\u4ec5\u53c2\u8003\u800c\u5df2\uff0c\u5e76\u4e0d\u4f1a\u53d1\u751f\u4efb\u4f55\u4e8b\u60c5\u3002<\/p>\n<h4>\u5408\u5e76\u8fdc\u7a0b\u5206\u652f\u7684\u66f4\u6539<\/h4>\n<p>\u5982\u679c\u8fdc\u7a0b\u8ddf\u8e2a\u5206\u652f\u88ab\u6ce8\u518c\u4e3a\u4e0a\u6e38\u5206\u652f\uff0c\u53ef\u4ee5\u4f7f\u7528\u65e0\u53c2\u6570\u7684\u5408\u5e76\u547d\u4ee4\u6765\u83b7\u53d6\u66f4\u6539\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git merge\r\n\r\n<\/code><\/pre>\n<p>\u6211\u559c\u6b22\u5403\u4e2d\u56fd\u83dc\u3002<\/p>\n<h3>2-5. \u6bd4\u8f03<\/h3>\n<h4>\u67e5\u770b\u63d0\u4ea4\u65e5\u5fd7<\/h4>\n<p>\u901a\u8fc7\u8ddf\u8e2a\u5f53\u524d\u7684commit\u5bf9\u8c61\u7684\u7236\u8282\u70b9\uff0c\u53ef\u4ee5\u663e\u793a\u5230\u8fbe\u7684\u6240\u6709commit\u3002<br \/>\n\u6309\u7167HEAD\u7684\u987a\u5e8f\u8fdb\u884c\u663e\u793a\u3002<br \/>\n\uff08\u5982\u679c\u5c06HEAD\u79fb\u52a8\u5230\u8fc7\u53bb\u7684commit\u4e2d\uff0c\u90a3\u4e48\u6bd4\u5b83\u66f4\u65b0\u7684commit\u5c06\u4e0d\u4f1a\u663e\u793a\u51fa\u6765\uff09<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u73fe\u5728\u306e\u30d6\u30e9\u30f3\u30c1\u306e\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u3092\u51fa\u529b\r\n<\/span><span class=\"gp\">$<\/span> git log\r\n<span class=\"go\">\r\n\/\/\u5168\u30d6\u30e9\u30f3\u30c1\u306e\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u3092\u51fa\u529b\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--all<\/span>\r\n<span class=\"go\">\r\n\/\/\u6700\u5f8c\u306eN\u500b\u306e\u30b3\u30df\u30c3\u30c8\u306e\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u3092\u51fa\u529b\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">-n<\/span>\r\n<span class=\"go\">\r\n\/\/\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u3092\u51fa\u529b\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--follow<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<\/code><\/pre>\n<h5>git log\u7684\u663e\u793a\u9009\u9879<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30b3\u30df\u30c3\u30c8\u756a\u53f7\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3092\u7701\u7565\u8868\u8a18(7\u6841)\u3067\u51fa\u529b\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--abbrev-commit<\/span>\r\n<span class=\"go\">\r\n\/\/\u30b0\u30e9\u30d5\u3067\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--graph<\/span>\r\n<span class=\"go\">\r\n\/\/\u30b3\u30df\u30c3\u30c8\u30ed\u30b0(\u7c21\u6613\u7248)\u3092\u51fa\u529b(\u30b3\u30df\u30c3\u30c8\u5c65\u6b74\u30921\u884c1\u5c65\u6b74)\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--oneline<\/span>\r\n<\/code><\/pre>\n<h5>\u6dfb\u52a0\u4fe1\u606f<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30d5\u30a1\u30a4\u30eb\u306e\u4fee\u6b63\u5185\u5bb9\u3092\u8ffd\u52a0\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">-p<\/span>\r\n<span class=\"go\"> \r\n\/\/\u5909\u66f4\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3068\u5dee\u5206\u91cf\u3092\u8ffd\u52a0\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--stat<\/span>\r\n<span class=\"go\"> \r\n\/\/\u30d5\u30a1\u30a4\u30eb\u6bce\u306e\u524a\u9664\u3001\u8ffd\u52a0\u884c\u6570\u3092\u8ffd\u52a0\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--numstat<\/span>\r\n<span class=\"go\"> \r\n\/\/\u5909\u66f4\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u8ffd\u52a0\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--name-status<\/span>\r\n<\/code><\/pre>\n<h5>\u7b5b\u9009<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/commit\u3092\u65e5\u4ed8\u3067\u7d5e\u308a\u8fbc\u307f(\u4ee5\u964d)\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--after<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"YYYY\/MM\/DD\"<\/span>\t\r\n<span class=\"gp\">$<\/span> git log <span class=\"nt\">--since<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"YYYY\/MM\/DD\"<\/span>\r\n<span class=\"go\">\r\n\/\/commit\u3092\u65e5\u4ed8\u3067\u7d5e\u308a\u8fbc\u307f(\u4ee5\u524d)\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--before<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"YYYY\/MM\/DD\"<\/span>\r\n<span class=\"gp\">$<\/span> git log <span class=\"nt\">--until<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"YYYY\/MM\/DD\"<\/span>\r\n<span class=\"go\">\r\n\/\/commit\u3092\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u3067\u7d5e\u308a\u8fbc\u307f\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--<\/span> \u30d1\u30b9\/\u30d5\u30a1\u30a4\u30eb\u540d\t\t\r\n<span class=\"go\">\r\n\/\/commit\u3092\u30b3\u30df\u30c3\u30bf\u30fc\u3067\u7d5e\u308a\u8fbc\u307f\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--author<\/span><span class=\"o\">=<\/span><span class=\"s2\">\"\u30e6\u30fc\u30b6\u30fc\u540d\"<\/span>\t\r\n<span class=\"go\">\r\n\/\/commit\u3092\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u542b\u307e\u308c\u308b\u6587\u5b57\u5217\u3067\u7d5e\u308a\u8fbc\u307f\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--grep<\/span><span class=\"o\">=<\/span><span class=\"s1\">'\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u542b\u307e\u308c\u308b\u6587\u5b57\"\t\r\n<\/span><span class=\"go\">\r\n\/\/commit\u3092\u30de\u30fc\u30b8\u30b3\u30df\u30c3\u30c8\u306e\u307f\u306b\u7d5e\u308a\u8fbc\u307f\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--merges<\/span>\r\n<span class=\"go\">\r\n\/\/commit\u3092\u30de\u30fc\u30b8\u30b3\u30df\u30c3\u30c8\u4ee5\u5916\u306b\u7d5e\u308a\u8fbc\u307f\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--no-merges<\/span>\t\r\n<span class=\"go\">\r\n\/\/\u8907\u6570\u306e\u89aa\u304c\u3042\u308b\u5834\u5408\u6700\u521d\u306e\u89aa\u30b3\u30df\u30c3\u30c8\u306e\u307f\u3092\u8ffd\u3046\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--first-parent<\/span>\t\r\n<span class=\"go\">\r\n\/\/\u30b3\u30df\u30c3\u30c81\u306e\u5b50\u5b6b\u3001\u304b\u3064\u30b3\u30df\u30c3\u30c82\u306e\u7956\u5148\u306e\u307f\u306b\u7d5e\u308a\u8fbc\u307f\r\n<\/span><span class=\"gp\">$<\/span> git log <span class=\"nt\">--ancestry-path<\/span> \u30b3\u30df\u30c3\u30c81...\u30b3\u30df\u30c3\u30c82\r\n<\/code><\/pre>\n<h4>\u6587\u4ef6\u72b6\u6001\u6bd4\u8f83<\/h4>\n<h5>\u5de5\u4f5c\u6811\u548c\u7d22\u5f15\u4e4b\u95f4\u7684\u5dee\u5f02<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u3068index\u306e\u5dee\u5206\r\n<\/span><span class=\"gp\">$<\/span> git diff \r\n<span class=\"go\"> \r\n\/\/\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u3068index\u306e\u5dee\u5206(\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u3064\u3044\u3066)\r\n<\/span><span class=\"gp\">$<\/span> git diff \u30d5\u30a1\u30a4\u30eb\u540d\r\n<\/code><\/pre>\n<h5>\u7d22\u5f15\u548c\u63d0\u4ea4\u7684\u5dee\u5f02<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/index\u3068HEAD\u306e\u6bd4\u8f03 (git diff --cached HEAD\u3068\u540c\u7fa9)\r\n<\/span><span class=\"gp\">$<\/span> git diff <span class=\"nt\">--cached<\/span>\r\n<span class=\"go\"> \r\n\/\/\u4e0a\u8a18\u3068\u540c\u3058(git diff --staged HEAD\u3068\u540c\u7fa9)\r\n<\/span><span class=\"gp\">$<\/span> git diff <span class=\"nt\">--staged<\/span>\r\n<span class=\"go\"> \r\n\/\/index\u3068HEAD\u306e\u6bd4\u8f03(\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u3064\u3044\u3066)\r\n<\/span><span class=\"gp\">$<\/span> git diff <span class=\"nt\">--cached<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"gp\">$<\/span> git diff <span class=\"nt\">--staged<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/index\u3068\u7279\u5b9a\u306e\u30b3\u30df\u30c3\u30c8\u306e\u5dee\u5206\r\n<\/span><span class=\"gp\">$<\/span> git diff commit\u306e\u30cf\u30c3\u30b7\u30e5 <span class=\"nt\">--staged<\/span>\t\r\n<span class=\"go\">\r\n\/\/index\u3068\u7279\u5b9a\u306e\u30b3\u30df\u30c3\u30c8\u306e\u5dee\u5206(\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u3064\u3044\u3066)\r\n<\/span><span class=\"gp\">$<\/span> git diff commit\u306e\u30cf\u30c3\u30b7\u30e5 <span class=\"nt\">--staged<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\t\r\n<\/code><\/pre>\n<h5>\u63d0\u4ea4\u548c\u63d0\u4ea4\u7684\u5dee\u522b<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u300c\u6700\u65b0\u306e\u30b3\u30df\u30c3\u30c8\u300d\u3068\u300c\u6700\u65b0\u306e\u30b3\u30df\u30c3\u30c8\u306e\u3072\u3068\u3064\u524d\u300d\u3068\u306e\u5dee\u5206\r\n<\/span><span class=\"gp\">$<\/span> git diff HEAD~\r\n<span class=\"go\">\r\n\/\/\u300c\u6700\u65b0\u306e\u30b3\u30df\u30c3\u30c8\u300d\u3068\u300c\u6700\u65b0\u306e\u30b3\u30df\u30c3\u30c8\u306e\u3072\u3068\u3064\u524d\u300d\u3068\u306e\u5dee\u5206(\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u3064\u3044\u3066)\r\n<\/span><span class=\"gp\">$<\/span> git diff HEAD~ \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\"> \r\n\/\/\u73fe\u5728\u306eHEAD\u3068\u7279\u5b9a\u306ecommit\u306e\u5dee\u5206\r\n<\/span><span class=\"gp\">$<\/span> git diff \u6bd4\u8f03\u3059\u308bcommit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"gp\">$<\/span> git diff \u6bd4\u8f03\u3059\u308b\u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/\u73fe\u5728\u306eHEAD\u3068\u7279\u5b9a\u306ecommit\u306e\u5dee\u5206(\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u3064\u3044\u3066)\r\n<\/span><span class=\"gp\">$<\/span> git diff \u6bd4\u8f03\u3059\u308bcommit\u306e\u30cf\u30c3\u30b7\u30e5 \u30d5\u30a1\u30a4\u30eb\u540d \r\n<span class=\"gp\">$<\/span> git diff \u6bd4\u8f03\u3059\u308b\u30d6\u30e9\u30f3\u30c1 \u30d5\u30a1\u30a4\u30eb\u540d  \r\n<span class=\"go\"> \r\n\/\/\u7279\u5b9a\u306e2\u3064\u306ecommit\u306e\u5dee\u5206\r\n<\/span><span class=\"gp\">$<\/span> git diff commit\u306e\u30cf\u30c3\u30b7\u30e51  commit\u306e\u30cf\u30c3\u30b7\u30e52\r\n<span class=\"gp\">$<\/span> git diff commit\u306e\u30cf\u30c3\u30b7\u30e51..commit\u306e\u30cf\u30c3\u30b7\u30e52\r\n<span class=\"gp\">$<\/span> git diff \u30d6\u30e9\u30f3\u30c1\u540d1 \u30d6\u30e9\u30f3\u30c1\u540d2\r\n<span class=\"gp\">$<\/span> git diff \u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u540d \u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/\u7279\u5b9a\u306e2\u3064\u306ecommit\u306e\u5dee\u5206(\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u3064\u3044\u3066)\r\n<\/span><span class=\"gp\">$<\/span> git diff commit1\u306e\u30cf\u30c3\u30b7\u30e5 commit2\u306e\u30cf\u30c3\u30b7\u30e5 \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"gp\">$<\/span> git diff \u30d6\u30e9\u30f3\u30c1\u540d1 \u30d6\u30e9\u30f3\u30c1\u540d2 \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"gp\">$<\/span> git diff \u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u540d \u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u540d \u30d5\u30a1\u30a4\u30eb\u540d\r\n<\/code><\/pre>\n<h5>\u5de5\u4f5c\u533a\u548c\u63d0\u4ea4\u7684\u5dee\u5f02<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u3068\u7279\u5b9a\u306e\u30b3\u30df\u30c3\u30c8\u306e\u5dee\u5206\r\n<\/span><span class=\"gp\">$<\/span> git diff commit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\">\r\n\/\/\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u3068\u7279\u5b9a\u306e\u30b3\u30df\u30c3\u30c8\u306e\u5dee\u5206(\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u3064\u3044\u3066)\r\n<\/span><span class=\"gp\">$<\/span> git diff commit\u306e\u30cf\u30c3\u30b7\u30e5 \u30d5\u30a1\u30a4\u30eb\u540d\r\n<\/code><\/pre>\n<h5>diff\u7684\u663e\u793a\u9009\u9879<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30d5\u30a1\u30a4\u30eb\u540d\u306e\u307f\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git diff <span class=\"nt\">--name-only<\/span>\t\r\n<\/code><\/pre>\n<h5>\u5bf9diff\u8fdb\u884c\u7b5b\u9009\u7684\u9009\u9879<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u5909\u66f4\u3057\u305f\u5dee\u5206\u3060\u3051\u306b\u7d5e\u308a\u8fbc\u307f\r\n<\/span><span class=\"gp\">$<\/span> git diff <span class=\"nt\">--diff-filter<\/span><span class=\"o\">=<\/span>M\r\n<span class=\"go\">\r\n\/\/\u524a\u9664\u3057\u305f\u5dee\u5206\u3060\u3051\u306b\u7d5e\u308a\u8fbc\u307f\r\n<\/span><span class=\"gp\">$<\/span> git diff <span class=\"nt\">--diff-filter<\/span><span class=\"o\">=<\/span>D\t\r\n<span class=\"go\">\r\n\/\/\u30ea\u30cd\u30fc\u30e0\u3057\u305f\u5dee\u5206\u3060\u3051\u306b\u7d5e\u308a\u8fbc\u307f\r\n<\/span><span class=\"gp\">$<\/span> git diff <span class=\"nt\">--diff-filter<\/span><span class=\"o\">=<\/span>R\t\r\n<\/code><\/pre>\n<h4>\u786e\u8ba4\u63d0\u4ea4\u7684\u5185\u5bb9<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u7279\u5b9a\u306e\u30b3\u30df\u30c3\u30c8\u306e\u4e2d\u8eab\u3092\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git show \u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\">\r\n\/\/HEAD\u306e\u30b3\u30df\u30c3\u30c8\u306e\u4e2d\u8eab\u3092\u78ba\u8a8d(HEAD\u306f\u7701\u7565\u53ef\u80fd)\r\n<\/span><span class=\"gp\">$<\/span> git show HEAD\r\n<span class=\"go\">\r\n\/\/\u30b3\u30df\u30c3\u30c8\u306e\u4e2d\u8eab\u3092\u78ba\u8a8d(\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a)\r\n<\/span><span class=\"gp\">$<\/span> git show \u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5:\u30d5\u30a1\u30a4\u30eb\u540d\r\n<\/code><\/pre>\n<h4>\u68c0\u67e5\u672c\u5730\u5b58\u50a8\u5e93\u7684\u72b6\u6001\u3002<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/staged\/modified\/untracked \u306e\u4e00\u89a7\u3001\u5dee\u5206\u60c5\u5831\u306a\u3069\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git status\r\n<span class=\"go\">\r\n\/\/\u7c21\u6613\u5f62\u5f0f\u3067\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git status <span class=\"nt\">-s<\/span>\r\n<span class=\"gp\">$<\/span> git status <span class=\"nt\">--short<\/span>\r\n<\/code><\/pre>\n<p>\u8bf7\u7ffb\u8bd1\u6210\u4e2d\u56fd\u8bed\uff1a\u53ea\u9700\u8981\u4e00\u79cd\u9009\u9879\u3002<\/p>\n<div>\n<div class=\"post-table\">\u30d5\u30a1\u30a4\u30eb\u306e\u30b9\u30c6\u30fc\u30bf\u30b9<br \/>\nstaged\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb(index\u3068HEAD\u306b\u5dee\u5206\u304c\u3042\u308b)modified\u5909\u66f4\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb(\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u3068index\u306b\u5dee\u5206\u304c\u3042\u308b)untrackedGit\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u3001gitignore\u306b\u3088\u3063\u3066\u7121\u8996\u3055\u308c\u306a\u3044\u30d5\u30a1\u30a4\u30eb<\/div>\n<\/div>\n<h4>\u67e5\u770b\u7279\u5b9a\u6587\u4ef6\u884c\u7684\u53d8\u66f4\u5386\u53f2\u3002<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u884c\u306e\u5909\u66f4\u5c65\u6b74(\u30d5\u30a1\u30a4\u30eb\u5185\u3067\u8ab0\u304c\u4f55\u3092\u3044\u3064\u5909\u66f4\u3057\u305f\u304b)\r\n<\/span><span class=\"gp\">$<\/span> git blame \u30d5\u30a1\u30a4\u30eb\u540d\t\r\n<span class=\"go\">\r\n\u884c\u306e\u5909\u66f4\u5c65\u6b74(\u30d5\u30a1\u30a4\u30eb\u5185\u3067\u8ab0\u304c\u4f55\u3092\u3044\u3064\u5909\u66f4\u3057\u305f\u304b) \u7701\u7565\u5f62\r\n<\/span><span class=\"gp\">$<\/span> git blame <span class=\"nt\">-s<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/\u30d5\u30a1\u30a4\u30eb\u306e\u6307\u5b9a\u3057\u305f\u884c\u306e\u5909\u66f4\u5c65\u6b74\u3092\u51fa\u529b\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git blame <span class=\"nt\">-L<\/span> \u884c\u756a\u53f71,\u884c\u756a\u53f72,... \u30d5\u30a1\u30a4\u30eb\u540d\t\r\n<\/code><\/pre>\n<h4>\u5c55\u793a\u5404\u4e2a\u5206\u652f\u7684\u63d0\u4ea4<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u5404\u30d6\u30e9\u30f3\u30c1\u306ecommit\u3092\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git show-branch\r\n<span class=\"go\">\r\n\/\/\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u3082\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git show-branch <span class=\"nt\">--all<\/span>\r\n<span class=\"go\">\r\n\/\/\u3082\u3063\u3068\u591a\u304f\u8868\u793a\r\n<\/span><span class=\"gp\">$<\/span> git show-branch <span class=\"nt\">--more<\/span><span class=\"o\">=<\/span>n\r\n<\/code><\/pre>\n<h4>\u786e\u8ba4\u4e24\u4e2a\u63d0\u4ea4\u7684\u5206\u652f\u6e90\u63d0\u4ea4\u3002<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/2\u3064\u306e\u30b3\u30df\u30c3\u30c8\u304c\u5206\u5c90\u3057\u305fcommit\u306e\u30cf\u30c3\u30b7\u30e5\u306e\u78ba\u8a8d(\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\u3067\u6307\u5b9a)\r\n<\/span><span class=\"gp\">$<\/span> git merge-base commit1\u306e\u30cf\u30c3\u30b7\u30e5 commit2\u306e\u30cf\u30c3\u30b7\u30e5\t\r\n<span class=\"go\">\r\n\/\/2\u3064\u306e\u30b3\u30df\u30c3\u30c8\u304c\u5206\u5c90\u3057\u305fcommit\u306e\u30cf\u30c3\u30b7\u30e5\u306e\u78ba\u8a8d(\u30d6\u30e9\u30f3\u30c1\u540d\u3067\u6307\u5b9a)\r\n<\/span><span class=\"gp\">$<\/span> git merge-base \u30d6\u30e9\u30f3\u30c11\u3000\u30d6\u30e9\u30f3\u30c12\r\n<\/code><\/pre>\n<h3>2-6. \u6587\u4ef6\u64cd\u4f5c<\/h3>\n<p>\u8bf7\u8fdb\u884c\u6587\u4ef6\u64cd\u4f5c<\/p>\n<h4>\u4fee\u6539\u6587\u4ef6\u540d\u79f0<\/h4>\n<p>\u53ea\u6709\u5df2\u88ab\u8ddf\u8e2a\u7684\u6587\u4ef6\u624d\u80fd\u8fdb\u884c\u91cd\u547d\u540d\u3002\u4e0d\u80fd\u5bf9\u672a\u88ab\u8ddf\u8e2a\u7684\u6587\u4ef6\u4f7f\u7528git mv\u547d\u4ee4\u3002<\/p>\n<h5>Git \u64cd\u4f5c<\/h5>\n<p>\u5728\u8fdb\u884c\u5206\u9636\u6bb5\u4e4b\u524d\uff0c\u8bf7\u5148\u786e\u8ba4\u5f53\u524d\u88ab\u7d22\u5f15\u7684\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ea\u30cd\u30fc\u30e0\u524d\u306b\u73fe\u5728\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<span class=\"go\">\r\n\/\/\u30d5\u30a1\u30a4\u30eb\u540d\u306e\u5909\u66f4\u3092\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git <span class=\"nb\">mv <\/span>\u73fe\u5728\u306e\u30d5\u30a1\u30a4\u30eb\u540d \u5909\u66f4\u5f8c\u306e\u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/\u73fe\u5728\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<\/code><\/pre>\n<p>\u901a\u8fc7\u89c2\u5bdf\u6682\u5b58\u533a\uff0c\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\u6587\u4ef6\u540d\u5df2\u7ecf\u53d8\u5316\uff0c\u4f46\u662f\u54c8\u5e0c\u503c\u6ca1\u6709\u6539\u53d8\u3002blob\u5bf9\u8c61\u5e76\u4e0d\u5305\u542b\u6587\u4ef6\u540d\u4fe1\u606f\uff0c\u800c\u662f\u7d22\u5f15\u4fdd\u7559\u4e86\u6587\u4ef6\u7684\u7ed3\u6784\u548c\u540d\u79f0\u3002<\/p>\n<h5>\u5728.git\u6587\u4ef6\u5939\u4e2d\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u8ffd\u52a0\u306a\u3057<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">.git\/index\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u66f4\u65b0\u3055\u308c\u308b<\/ul>\n<h4>\u6587\u4ef6\u7684\u79fb\u52a8<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u79fb\u52d5\u524d\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<span class=\"go\">\r\n\/\/git\u30b3\u30de\u30f3\u30c9\u3067\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u79fb\u52d5(1\u56de\u3067\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3055\u308c\u308b)\r\n<\/span><span class=\"gp\">$<\/span> git <span class=\"nb\">mv <\/span>\u73fe\u5728\u306e\u30d1\u30b9\/\u30d5\u30a1\u30a4\u30eb\u540d \u79fb\u52d5\u5f8c\u306e\u30d1\u30b9\/\u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/git\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u308f\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u79fb\u52d5(\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u307e\u30672\u624b\u304b\u304b\u308b)\r\n<\/span><span class=\"gp\">$<\/span> <span class=\"nb\">mv  <\/span>\u73fe\u5728\u306e\u30d1\u30b9\/\u30d5\u30a1\u30a4\u30eb\u540d \u79fb\u52d5\u5f8c\u306e\u30d1\u30b9\/\u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"gp\">$<\/span> git add \u79fb\u52d5\u5f8c\u306e\u30d1\u30b9\/\u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/\u73fe\u5728\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u4e2d\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u8ffd\u52a0\u306a\u3057<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">.git\/index\u306e\u30d1\u30b9\/\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u66f4\u65b0\u3055\u308c\u307e\u3059\u3002 (git mv\u3067\u3082\u3001mv+git add\u3067\u3082blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\u306f\u5909\u308f\u308a\u307e\u305b\u3093\u3002)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">(mv+add\u3067\u3082rename\u306b\u306a\u308b\u306e\u3067commit\u3059\u308b\u3068\u5c65\u6b74\u304c\u8ffd\u3048\u3066\u3044\u307e\u3059\u3002)<\/ul>\n<h4>\u5220\u9664\u6587\u4ef6<\/h4>\n<p>\u5982\u679c\u5728Git\u7ba1\u7406\u4e0b\u7684\u5de5\u4f5c\u76ee\u5f55\u4e2d\u624b\u52a8\u5220\u9664\u4e86\u4e00\u4e2a\u4e0d\u5728Git\u7ba1\u7406\u4e0b\u7684\u6587\u4ef6\uff0c\u90a3\u4e48\u5b83\u5c31\u50cf\u4ece\u4e00\u5f00\u59cb\u5c31\u4e0d\u5b58\u5728\u4e00\u6837\u5904\u7406\u3002<br \/>\n\u5982\u679c\u4f7f\u7528git rm\u547d\u4ee4\u5220\u9664\u4e86\u5728Git\u7ba1\u7406\u4e0b\u7684\u6587\u4ef6\uff0c\u5b83\u5c06\u4ece\u7d22\u5f15\u4e2d\u5220\u9664\uff0c\u56e0\u6b64\u4e0d\u9700\u8981&#8221;\u6dfb\u52a0&#8221;\u5220\u9664\u64cd\u4f5c\u3002<br \/>\n\u5982\u679c\u8981\u4f7f\u7528rm\u547d\u4ee4\u800c\u4e0d\u662fgit rm\u547d\u4ee4\u5220\u9664\u5728Git\u7ba1\u7406\u4e0b\u7684\u6587\u4ef6\uff0c\u5219\u9700\u8981\u6dfb\u52a0\u5df2\u88ab\u5220\u9664\u7684\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/git\u30b3\u30de\u30f3\u30c9\u3067\u306e\u30d5\u30a1\u30a4\u30eb\u524a\u9664(\u8ffd\u8de1\u6e08\u307f\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u6709\u52b9)(1\u56de\u3067\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3055\u308c\u308b)\r\n<\/span><span class=\"gp\">$<\/span> git <span class=\"nb\">rm <\/span>\u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/git\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u308f\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u524a\u9664(\u8ffd\u8de1\u6e08\u307f\u30d5\u30a1\u30a4\u30eb\u306e\u5834\u5408\u306f\u5225\u9014add\u304c\u5fc5\u8981)(\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u307e\u30672\u624b\u304b\u304b\u308b)\r\n<\/span><span class=\"gp\">$<\/span> <span class=\"nb\">rm <\/span>\u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"gp\">$<\/span> git add \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/git\u30b3\u30de\u30f3\u30c9\u3067\u306e\u30d5\u30a1\u30a4\u30eb\u524a\u9664(\u30d5\u30a1\u30a4\u30eb\u524a\u9664\u3092\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3059\u308b)(\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u6b8b\u308b) \u3000\r\n<\/span><span class=\"gp\">$<\/span> git <span class=\"nb\">rm<\/span> <span class=\"nt\">--cached<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<\/code><\/pre>\n<h4>\u522a\u9664\u672a\u88ab\u8ffd\u8e64\u7684\u6a94\u6848<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/Git\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3059\u3079\u3066\u3092\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span>git clean <span class=\"nt\">-n<\/span>\t\r\n<span class=\"go\">\r\n\/\/Git\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3059\u3079\u3066\u3092\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git clean\t\r\n<span class=\"go\"> \r\n\/\/Git\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3059\u3079\u3066\u3092\u524a\u9664(\u5f37\u5236)\r\n<\/span><span class=\"gp\">$<\/span> git clean <span class=\"nt\">-f<\/span>\t\r\n<span class=\"go\">\r\n\/\/Git\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664(\u5f37\u5236)\r\n<\/span><span class=\"gp\">$<\/span> git clean <span class=\"nt\">-f<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/Git\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u5bfe\u8a71\u30e2\u30fc\u30c9\u3067\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git clean <span class=\"nt\">-i<\/span>\t\r\n<\/code><\/pre>\n<h4>\u5728.git\u6587\u4ef6\u5939\u5185\u53d1\u751f\u7684\u4e8b\u60c5\u3002<\/h4>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u6d88\u3048\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">.git\/index\u304b\u3089\u524a\u9664\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u6d88\u3048\u308b<\/ul>\n<p>\u5c3d\u7ba1\u5728\u5de5\u4f5c\u76ee\u5f55\u4e2d\u5220\u9664\u4e86\u6682\u5b58\u6587\u4ef6\uff0c\u4e0d\u8fdb\u884cadd\u64cd\u4f5c\u7684\u60c5\u51b5\u4e0b\u63d0\u4ea4\uff0c\u5219\u5728\u7d22\u5f15\u4e2d\u4ecd\u7136\u5b58\u5728\uff0c\u4f1a\u5305\u542b\u5728\u63d0\u4ea4\u4e2d\u3002<\/p>\n<h4>\u53ea\u5220\u9664\u672a\u88abgit\u8ffd\u8e2a\u7684\u6587\u4ef6\u3002<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/Git\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3059\u3079\u3066\u3092\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git clean <span class=\"nt\">-n<\/span>\r\n<span class=\"go\">\r\n\/\/Git\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u3059\u3079\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git clean <span class=\"nt\">-f<\/span>\r\n<span class=\"go\">\r\n\/\/Git\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git clean <span class=\"nt\">-f<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<\/code><\/pre>\n<h4>\u66f4\u6539\u6587\u4ef6\u5939\u540d\u79f0<\/h4>\n<p>\u4f7f\u7528git ls-files\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u6682\u5b58\u533a\uff08staging-area\uff09\u4e2d\u7d22\u5f15\u7684\u6587\u4ef6\u3002\u901a\u8fc7-s\uff08&#8211;stage\uff09\u9009\u9879\uff0c\u53ef\u4ee5\u663e\u793a\u5b58\u50a8\u5728\u4ed3\u5e93\u4e2d\u7684blob\u54c8\u5e0c\u503c\u548c\u6587\u4ef6\u540d\u7684\u5217\u8868\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ea\u30cd\u30fc\u30e0\u524d\u306b\u73fe\u5728\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<span class=\"go\">\r\n\/\/\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u306e\u5909\u66f4\u3092\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git <span class=\"nb\">mv <\/span>\u73fe\u5728\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d \u5909\u66f4\u5f8c\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\r\n<span class=\"go\">\r\n\/\/\u73fe\u5728\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<\/code><\/pre>\n<p>\u5728\u6682\u5b58\u533a\u4e2d\uff0c\u4f60\u53ef\u4ee5\u770b\u5230\u6587\u4ef6\u540d\u5df2\u7ecf\u6539\u53d8\uff0c\u4f46\u54c8\u5e0c\u503c\u5e76\u6ca1\u6709\u6539\u53d8\u3002<br \/>\nBlob\u5bf9\u8c61\u5e76\u4e0d\u4fdd\u5b58\u6587\u4ef6\u540d\u7684\u4fe1\u606f\uff0c\u800c\u662f\u7d22\u5f15\u4fdd\u5b58\u4e86\u6587\u4ef6\u7684\u7ed3\u6784\u548c\u540d\u79f0\u3002<\/p>\n<h5>\u5728.git\u5185\u6240\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<p>\u5728.git\/index\u4e2d\uff0c\u76ee\u5f55\u540d\/\u6587\u4ef6\u540d\u5df2\u7ecf\u88ab\u4fee\u6539\u3002<\/p>\n<h4>\u5207\u6362\u76ee\u5f55<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ea\u30cd\u30fc\u30e0\u524d\u306b\u73fe\u5728\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<span class=\"go\">\r\n\/\/\u79fb\u52d5\r\n<\/span><span class=\"gp\">$<\/span> git <span class=\"nb\">mv <\/span>\u73fe\u5728\u306e\u30d1\u30b9\/\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d \u5909\u66f4\u5f8c\u306e\u30d1\u30b9\/\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\r\n<span class=\"go\">\r\n\/\/\u73fe\u5728\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3055\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git ls-files <span class=\"nt\">--stage<\/span>\r\n<\/code><\/pre>\n<p>\u5728\u6682\u5b58\u533a\u4e2d\u53ef\u4ee5\u770b\u5230\u6587\u4ef6\u540d\u5df2\u7ecf\u6539\u53d8\uff0c\u4f46\u54c8\u5e0c\u503c\u6ca1\u6709\u6539\u53d8\u3002<br \/>\nblob\u5bf9\u8c61\u5e76\u4e0d\u4fdd\u5b58\u6587\u4ef6\u540d\u4fe1\u606f\u3002<br \/>\n\u7d22\u5f15\u4fdd\u5b58\u7740\u6587\u4ef6\u7684\u7ed3\u6784\u548c\u540d\u79f0\u3002<\/p>\n<h5>\u5728.git\u6587\u4ef6\u5939\u4e2d\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<p>\u5728.git\/index\u4e2d\uff0c\u5df2\u7ecf\u66f4\u6539\u4e86\u76ee\u5f55\u540d\/\u6587\u4ef6\u540d\u3002<\/p>\n<h4>\u5220\u9664\u76ee\u5f55\u53ca\u5176\u5185\u5bb9<\/h4>\n<p>\u76ee\u5f55\u672c\u8eab\u4e5f\u662f\u4e0d\u540c\u4e8e\u6811\u5bf9\u8c61\u7684\u4e00\u70b9\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u3068\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u306e\u4e21\u65b9\u3092\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git <span class=\"nb\">rm<\/span> <span class=\"nt\">-r<\/span> \u30d1\u30b9\/\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\r\n<span class=\"go\">\r\n\/\/\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u306e\u307f\u524a\u9664(\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u6b8b\u308b) \r\n<\/span><span class=\"gp\">$<\/span> git <span class=\"nb\">rm<\/span> <span class=\"nt\">-r<\/span> <span class=\"nt\">--cached<\/span> \u30d1\u30b9\/\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\r\n<\/code><\/pre>\n<h4>\u5220\u9664\u672a\u88ab\u8ffd\u8e2a\u7684\u76ee\u5f55\u3002<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/Git\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068\u30d5\u30a1\u30a4\u30eb\u3059\u3079\u3066\u3092\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git clean <span class=\"nt\">-dn<\/span>\r\n<span class=\"go\"> \r\n\/\/Git\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068\u30d5\u30a1\u30a4\u30eb\u3059\u3079\u3066\u3092\u524a\u9664(\u5f37\u5236)\r\n<\/span><span class=\"gp\">$<\/span> git clean <span class=\"nt\">-df<\/span>\r\n<span class=\"go\">\r\n\/\/Git\u3067\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u7279\u5b9a\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u524a\u9664\r\n<\/span><span class=\"gp\">$<\/span> git clean <span class=\"nt\">-f<\/span> \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\t\r\n<\/code><\/pre>\n<h3>2-7. \u6587\u4ef6\u6062\u590d<\/h3>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/460-0.png\" alt=\"2-7-1.png\" \/><\/div>\n<h4>\u5f53\u6587\u4ef6\u88ab\u6dfb\u52a0\u5230\u7d22\u5f15\u65f6\uff0c\u5c06\u5176\u72b6\u6001\u8fd8\u539f\u5230\u5de5\u4f5c\u76ee\u5f55\u3002<\/h4>\n<p>\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u63d0\u4ea4\uff0c\u5219\u5c06\u4ece\u7d22\u5f15\u4e2d\u6062\u590d\u3002<\/p>\n<h5>Git\u7684\u64cd\u4f5c\u65b9\u5f0f<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3057\u305f\u6642\u70b9\u306e\u72b6\u614b\u306b\u5fa9\u5143\u3000\u30b3\u30df\u30c3\u30c8\u8b58\u5225\u5b50\u306e\u5f15\u6570\u304c\u7121\u3044\u5834\u5408\u306f\u3001\u5fa9\u5143\u5143\u306f\u300c\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u300d\u304c\u5bfe\u8c61\r\n<\/span><span class=\"gp\">$<\/span> git restore \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3057\u305f\u6642\u70b9\u306e\u72b6\u614b\u306b\u3001\u90e8\u5206\u3054\u3068\u306b\u533a\u5207\u3063\u3066\u5fa9\u5143\u7b87\u6240\u3092\u6307\u5b9a\r\n<\/span><span class=\"gp\">$<\/span> git restore <span class=\"nt\">-p<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<\/code><\/pre>\n<h5>\u5728`.git`\u5185\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<ul class=\"post-ul\">.git\u3067\u306f\u4f55\u3082\u8d77\u304d\u306a\u3044<\/ul>\n<h4>\u6062\u590d\u7279\u5b9a\u63d0\u4ea4\u7684\u6587\u4ef6<\/h4>\n<p>\u5f53\u6587\u4ef6\u88ab\u63d0\u4ea4(commit)\u65f6\uff0c\u5c06\u5176\u72b6\u6001\u6062\u590d\u5230\u5de5\u4f5c\u76ee\u5f55\u4e2d\u3002<br \/>\n\u4e5f\u53ef\u4ee5\u7528\u4e8e\u6062\u590d\u5df2\u5220\u9664\u7684\u6587\u4ef6\u3002<\/p>\n<h5>Git\u64cd\u4f5c\u6307\u7684\u662f\u4f7f\u7528Git\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u8fdb\u884c\u5404\u79cd\u64cd\u4f5c\u7684\u8fc7\u7a0b\u3002<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/HEAD\u304b\u3089\u5fa9\u5143\r\n<\/span><span class=\"gp\">$<\/span> git restore <span class=\"nt\">-s<\/span> HEAD \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/HEAD\u304b\u3089\u3044\u304f\u3064\u524d\u306e\u30b3\u30df\u30c3\u30c8\u304b\u6307\u5b9a\u3057\u3066\u5fa9\u5143\r\n<\/span><span class=\"gp\">$<\/span> git restore <span class=\"nt\">-s<\/span> @~n \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"gp\">$<\/span> git restore <span class=\"nt\">-s<\/span> HEAD~n \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\u3000\r\n\/\/commit\u306e\u30cf\u30c3\u30b7\u30e5\u3092\u6307\u5b9a\u3057\u3066\u5fa9\u5143\r\n<\/span><span class=\"gp\">$<\/span> git restore <span class=\"nt\">-s<\/span> \u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5 \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/commit\u306e\u30cf\u30c3\u30b7\u30e5\u3092\u6307\u5b9a\u3057\u3066\u90e8\u5206\u3054\u3068\u306b\u533a\u5207\u3063\u3066\u5fa9\u5143\u7b87\u6240\u3092\u6307\u5b9a\r\n<\/span><span class=\"gp\">$<\/span> git restore <span class=\"nt\">-p<\/span> <span class=\"nt\">-s<\/span> commit\u306e\u30cf\u30c3\u30b7\u30e5 \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/\u30b3\u30df\u30c3\u30c8\u6642\u70b9\u306e\u72b6\u614b\u3092\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u306b\u53cd\u6620\r\n<\/span><span class=\"gp\">$<\/span> git restore <span class=\"nt\">--staged<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\t\r\n<span class=\"go\">   \r\n\/\/\u30b3\u30df\u30c3\u30c8\u6642\u70b9\u306e\u72b6\u614b\u3092\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u306b\u53cd\u6620\r\n<\/span><span class=\"gp\">$<\/span> git restore <span class=\"nt\">--source<\/span><span class=\"o\">=<\/span>HEAD \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\"> \r\n\/\/\u30b3\u30df\u30c3\u30c8\u6642\u70b9\u306e\u72b6\u614b\u3092\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3068\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u4e21\u65b9\u306b\u53cd\u6620\r\n<\/span><span class=\"gp\">$<\/span> git restore <span class=\"nt\">--source<\/span><span class=\"o\">=<\/span>HEAD <span class=\"nt\">--staged<\/span> <span class=\"nt\">--worktree<\/span> \u30d5\u30a1\u30a4\u30eb\u540d\r\n<\/code><\/pre>\n<p>\u5728restore\u7684-s\/&#8211;source\u9009\u9879\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6307\u5b9a\u8981\u6062\u590d\u7684\u63d0\u4ea4\u3002<\/p>\n<h5>\u53d1\u751f\u5728 .git \u5185\u90e8\u7684\u4e8b\u4ef6<\/h5>\n<ul class=\"post-ul\">.git\u3067\u306f\u4f55\u3082\u8d77\u304d\u306a\u3044<\/ul>\n<h3>2-8. \u5934\u90e8\u7684\u79fb\u52a8<\/h3>\n<p>\u53ef\u4ee5\u4f7f\u7528git reset\u547d\u4ee4\u5c06\u5f53\u524d\u4f4d\u7f6e\u79fb\u52a8\u5230\u4efb\u610f\u7684commit\u3002\u8fd9\u91cc\u6240\u8bf4\u7684&#8221;reset&#8221;\u5e76\u4e0d\u662f\u6307\u56de\u9000\u67d0\u4e2a\u7248\u672c\uff0c\u800c\u662f\u79fb\u52a8commit\u6240\u5f15\u7528\u7684HEAD\u3002\u901a\u8fc7\u9009\u9879\uff0c\u53ef\u4ee5\u51b3\u5b9a\u8981\u5c06\u54ea\u4e2a\u65f6\u95f4\u70b9\u7684\u72b6\u6001\u53cd\u6620\u5230\u6682\u5b58\u533a\u548c\u5de5\u4f5c\u76ee\u5f55\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/476-0.png\" alt=\"2-10.png\" \/><\/div>\n<h4>\u786e\u8ba4\u5f53\u524d\u7684HEAD\u72b6\u6001<\/h4>\n<h5>Git\u64cd\u4f5c<\/h5>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git log <span class=\"nt\">-1<\/span>\r\n<\/code><\/pre>\n<h5>\u53d1\u751f\u5728.git\u5185\u90e8\u7684\u4e8b\u60c5<\/h5>\n<ul class=\"post-ul\">.git\u3067\u306f\u4f55\u3082\u8d77\u304d\u306a\u3044<\/ul>\n<h5>\u4ece.git\u6587\u4ef6\u5939\u4e2d\u7684\u6587\u4ef6\u4e2d\u67e5\u627eHEAD\u63d0\u4ea4\u7684\u54c8\u5e0c\u503c\u3002<\/h5>\n<p>\u73b0\u5728\u7684\u5206\u652f de zh\u012b)<\/p>\n<pre class=\"post-pre\"><code>ref: refs\/heads\/\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<p>\u4ece\u8be5\u5206\u652f\u540d\u79f0\u7684\u6587\u4ef6\u4e2d\u68c0\u67e5\u54c8\u5e0c\u503c\u3002<\/p>\n<pre class=\"post-pre\"><code>\u73fe\u5728\u306ebranch\u304c\u6307\u3059commit\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\n<\/code><\/pre>\n<h4>\u5934\u90e8\u7684\u79fb\u52a8<\/h4>\n<h5>Git\u64cd\u4f5c &#8211; \u4f7f\u7528Git\u8fdb\u884c\u64cd\u4f5c<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3092HEAD\u306e\u30b3\u30df\u30c3\u30c8\u72b6\u614b\u306b\u623b\u3059\u3002\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u3068HEAD\u306f\u305d\u306e\u307e\u307e(add\u53d6\u308a\u6d88\u3057)\r\n\/\/git reset --mixed HEAD\u3068\u540c\u3058\r\n<\/span><span class=\"gp\">$<\/span> git reset\t\r\n<span class=\"go\">\r\n\/\/\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u304b\u3089\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u306b\u623b\u3059(commit\u3001index\u3092\u5143\u306b\u623b\u3059)\r\n\/\/git reset --mixed HEAD \u30d5\u30a1\u30a4\u30eb\u540d\u3068\u540c\u3058\r\n<\/span><span class=\"gp\">$<\/span> git reset \u30d5\u30a1\u30a4\u30eb\u540d\r\n<span class=\"go\">\r\n\/\/\u30b3\u30df\u30c3\u30c8\u3092\u6307\u5b9a\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u3092\u5fa9\u5143\u3059\u308b(commit\u3001index\u3092\u3082\u3068\u306b\u623b\u3059) \r\n<\/span><span class=\"gp\">$<\/span> git reset commit\u306e\u30cf\u30c3\u30b7\u30e5 \u30d5\u30a1\u30a4\u30eb\u540d\t\r\n<\/code><\/pre>\n<div>\n<div class=\"post-table\">reset\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30b3\u30df\u30c3\u30c8&#8211;sof&#8211;\u6307\u5b9a\u306ecommit\u306b\u79fb\u52d5&#8211;mixed\u30aa\u30d7\u30b7\u30e7\u30f3\u7701\u7565\u6642-\u623b\u3057\u305fcommit\u306e\u72b6\u614b\u3092\u53cd\u6620&#8211;hard\u623b\u3057\u305f\u30b3\u30df\u30c3\u30c8\u306e\u72b6\u614b\u3092\u53cd\u6620\u623b\u3057\u305fcommit\u306e\u72b6\u614b\u3092\u53cd\u6620\u6307\u5b9a\u306ecommit\u306b\u79fb\u52d5<\/div>\n<\/div>\n<p>\u4e3a\u4e86\u786e\u5b9a\u8981\u79fb\u5230\u54ea\u4e2aHEAD\uff0c\u663e\u793aHEAD\u79fb\u52a8\u7684\u65e5\u5fd7\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u79fb\u52d5\u3057\u305f\u3044HEAD\u3092\u8abf\u3079\u308b\r\n\/\/HEAD\u306e\u79fb\u52d5\u5c65\u6b74\u3092\u51fa\u529b\r\n<\/span><span class=\"gp\">$<\/span> git reflog\r\n<span class=\"go\">\r\n\/\/\u64cd\u4f5c\u5c65\u6b74\u6570\u3092\u6307\u5b9a\u3057\u3066\u51fa\u529b\r\n<\/span><span class=\"gp\">$<\/span> git reflog <span class=\"nt\">-n<\/span>\t\r\n<span class=\"go\">\r\n\/\/\u5b9f\u969b\u306bHEAD\u3092\u79fb\u52d5\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git reset <span class=\"nt\">--hard<\/span> HEAD@<span class=\"o\">{<\/span>n<span class=\"o\">}<\/span>\r\n<\/code><\/pre>\n<h5>\u53d1\u751f\u5728.git\u6587\u4ef6\u5939\u4e2d\u7684\u4e8b\u60c5<\/h5>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">index\u306f\u623b\u3057\u305f\u30b3\u30df\u30c3\u30c8\u307e\u3067\u306e\u6642\u70b9\u306b\u623b\u3063\u3066\u3044\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">commit\u3001\u30b9\u30c6\u30fc\u30b8\u3001\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u306b\u623b\u3057\u305f\u5148\u306eHEAD\u306e\u72b6\u614b\u304c\u53cd\u6620\u3055\u308c\u308b<\/ul>\n<pre class=\"post-pre\"><code>\u65b0\u3057\u304fHEAD\u304c\u6307\u3059commit\u30d6\u30e9\u30f3\u30c1\u306e\u30cf\u30c3\u30b7\u30e5\u306b\u66f8\u304d\u63db\u308f\u308b\r\n<\/code><\/pre>\n<p>\u7531\u4e8e\u63d0\u4ea4\u5bf9\u8c61\uff08commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff09\u53ea\u6709\u5bf9\u7236\u63d0\u4ea4\u7684\u5f15\u7528\uff0c\u56e0\u6b64\u5728git log\u4e2d\u65e0\u6cd5\u663e\u793a\u5b50\u63d0\u4ea4\u3002<br \/>\n\u901a\u8fc7git reflog\uff0c\u53ef\u4ee5\u67e5\u770b\u8fc7\u53bbHEAD\u7684\u79fb\u52a8\u5386\u53f2\uff0c\u56e0\u6b64\u53ef\u4ee5\u79fb\u52a8\u5230HEAD\u4e4b\u524d\u7684\u63d0\u4ea4\u3002<br \/>\nreflog\u662fref\uff08\u5f15\u7528\uff09\u79fb\u52a8\u7684\u5386\u53f2\u8bb0\u5f55\uff0c\u56e0\u6b64\u662f\u8de8\u5206\u652f\u7684\u5386\u53f2\u8bb0\u5f55\u3002<br \/>\n\u4e5f\u53ef\u4ee5\u8fd4\u56de\u5230\u5176\u4ed6\u5206\u652f\u7684\u63d0\u4ea4\u5386\u53f2\u3002<br \/>\n\u53ea\u80fd\u4fdd\u7559\u5728\u5de5\u4f5c\u76ee\u5f55\u548c\u6682\u5b58\u533a\u4e2d\u7684\u6587\u4ef6\uff08\u56e0\u4e3a\u53d8\u4e3a\u5b8c\u5168\u63d0\u4ea4\u65f6\u7684\u72b6\u6001\uff09\u3002<\/p>\n<h3>2-9. \u66f4\u6539\u63d0\u4ea4\u8bb0\u5f55\u7684\u5386\u53f2<\/h3>\n<p>\u5728\u66f4\u6539\u63d0\u4ea4\u5386\u53f2\u65f6\uff0c\u5982\u679c\u4fee\u6539\u4e86\u76f8\u540c\u90e8\u5206\uff0c\u5219\u53ef\u80fd\u53d1\u751f\u51b2\u7a81\u3002<br \/>\n\u5982\u679c\u53d1\u751f\u51b2\u7a81\uff0c\u9700\u8981\u7f16\u8f91\u4ee5\u51b3\u5b9a\u4fdd\u7559\u54ea\u4e2a\u4fee\u6539\u3002<\/p>\n<h4>\u786e\u8ba4\u9a6c\u5409\u7684\u60c5\u51b5\u3002<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u73fe\u5728\u306e\u30d6\u30e9\u30f3\u30c1\u306b\u30de\u30fc\u30b8\u3055\u308c\u3066\u3044\u308b\u30d6\u30e9\u30f3\u30c1\u3092\u51fa\u529b\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">--merged<\/span>\t\r\n<span class=\"go\">\r\n\/\/\u73fe\u5728\u306e\u30d6\u30e9\u30f3\u30c1\u306b\u30de\u30fc\u30b8\u3055\u308c\u3066\u3044\u306a\u3044\u30d6\u30e9\u30f3\u30c1\u3092\u51fa\u529b\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git branch <span class=\"nt\">--no-merged<\/span>\t\r\n<\/code><\/pre>\n<h4>\u5408\u5e76\u5206\u652f<\/h4>\n<p>\u5c06\u5206\u652f\u6574\u5408\u7684\u8fc7\u7a0b\u79f0\u4e3a\u5206\u652f\u5408\u5e76\u3002<\/p>\n<h5>Git\u64cd\u4f5c<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u73fe\u5728\u306ebranch\u306b\u7279\u5b9a\u306e\u30d6\u30e9\u30f3\u30c1\u3092\u30de\u30fc\u30b8\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git merge \u7279\u5b9a\u306e\u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/\u73fe\u5728\u306ebranch\u306b\u7279\u5b9a\u306ebranch\u3092\u30de\u30fc\u30b8\u3059\u308b(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3082\u6307\u5b9a)\r\n<\/span><span class=\"gp\">$<\/span> git merge <span class=\"nt\">-m<\/span> <span class=\"s2\">\"\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\"<\/span> \u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/\u73fe\u5728\u306ebranch\u306b\u7279\u5b9a\u306ebranch\u3092\u30de\u30fc\u30b8\u3059\u308b(\u30d5\u30a1\u30b9\u30c8\u30d5\u30a9\u30ef\u30fc\u30c9\u30de\u30fc\u30b8\u3067\u3082\u30de\u30fc\u30b8\u30b3\u30df\u30c3\u30c8\u3092\u4f5c\u6210)\r\n<\/span><span class=\"gp\">$<\/span> git merge \u7279\u5b9a\u306e\u30d6\u30e9\u30f3\u30c1\u540d <span class=\"nt\">--no-ff<\/span>\t\r\n<span class=\"go\">\r\n\/\/\u7279\u5b9a\u306e\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1\u3092\u7279\u5b9a\u306e\u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u306b\u30de\u30fc\u30b8\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git merge \u30aa\u30ea\u30b8\u30f3\u540d\/\u30d6\u30e9\u30f3\u30c1\u540d \u30d6\u30e9\u30f3\u30c1\u540d\t\r\n<\/code><\/pre>\n<h5>\u4e00\u65e6\u53d1\u751f\u51b2\u7a81<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\r\n\/\/\u7d99\u7d9a(\u7af6\u5408\u3092\u4fee\u6b63\u3057\u305f\u5f8cadd\u3068commit\u3092\u81ea\u5206\u3067\u884c\u3046)\r\n<\/span><span class=\"gp\">$<\/span> git add \r\n<span class=\"gp\">$<\/span> git commit\r\n<span class=\"go\">\r\n\/\/\u7d99\u7d9a(\u7af6\u5408\u3092\u4fee\u6b63\u3057\u305f\u5f8cmerge\u306e\u7d9a\u304d\u3092\u884c\u3046)\r\n<\/span><span class=\"gp\">$<\/span> git merge <span class=\"nt\">--continue<\/span>\r\n<span class=\"go\">\r\n\r\n\/\/\u4e2d\u6b62(\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u306e\u7de8\u96c6\u3092\u3057\u3066\u3044\u306a\u3044\u3068\u304d)\r\n<\/span><span class=\"gp\">$<\/span> git merge <span class=\"nt\">--abort<\/span>\r\n<span class=\"go\">\r\n\/\/\u4e2d\u6b62(\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u306e\u7de8\u96c6\u3092\u3057\u3066\u3044\u308b\u3068\u304d)\r\n<\/span><span class=\"gp\">$<\/span> git reset <span class=\"nt\">--hard<\/span> HEAD\r\n<\/code><\/pre>\n<h5>\u5728.git\u6587\u4ef6\u5939\u4e2d\u53d1\u751f\u7684\u4e8b\u60c5<\/h5>\n<p>\u89e3\u51b3\u51b2\u7a81\u65f6\uff0c\u5982\u679c\u53ea\u9700\u8981\u5b8c\u5168\u4fdd\u7559\u4e00\u65b9\uff0c\u5219\u5c06\u4fdd\u7559\u5176\u4e2d\u4e00\u4e2ablob\u5bf9\u8c61\u3002\u7531\u4e8e\u4e24\u8005\u4e0d\u5b8c\u5168\u76f8\u540c\uff0c\u56e0\u6b64\u54c8\u5e0c\u503c\u4f1a\u53d1\u751f\u53d8\u5316\uff0c\u88ab\u89c6\u4e3a\u65b0\u7684\u6587\u4ef6\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30b3\u30df\u30c3\u30c8\u304c\u4f5c\u3089\u308c\u30661\u3064\u9032\u3080<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u306f\u81ea\u52d5\u3067\u5165\u308b<\/ul>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git log\r\n<span class=\"go\">\r\nMerge branch '\u53d6\u308a\u8fbc\u307e\u308c\u308b\u30d6\u30e9\u30f3\u30c1\u540d' into \u53d6\u308a\u8fbc\u3080\u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/span><\/code><\/pre>\n<ul class=\"post-ul\">COMMIT_EDITMSG\u306f\u305d\u306e\u307e\u307e<\/ul>\n<pre class=\"post-pre\"><code>(merge\u5143\u306ebranch\u306e\u6700\u5f8c\u306e\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u307e\u307e\u5909\u5316\u306a\u3057)\r\n<\/code><\/pre>\n<ul class=\"post-ul\">commit\u304c\u3064\u304f\u3089\u308c\u3066\u3001HEAD\u306f1\u3064\u3059\u3059\u3080<\/ul>\n<pre class=\"post-pre\"><code>\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5(40\u6841)\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git log\r\n<span class=\"go\">\r\n1.\u30de\u30fc\u30b8\u3057\u3066\u3067\u304d\u305fcommit\r\n2.\u53d6\u308a\u8fbc\u307e\u308c\u305f\u30d6\u30e9\u30f3\u30c1\u306eHEAD\u3060\u3063\u305fcommit\r\n3.\u53d6\u308a\u8fbc\u3080\u30d6\u30e9\u30f3\u30c1\u306eHEAD\u3060\u3063\u305fcommit\r\n<\/span><\/code><\/pre>\n<p>ORIG_HEAD \u662f\u4e4b\u524d\u4e00\u76f4\u662f HEAD \u7684\u300c\u8981\u5408\u5e76\u7684\u5206\u652f\u7684 HEAD \u7684\u63d0\u4ea4\u300d\u3002<\/p>\n<pre class=\"post-pre\"><code>\u53d6\u308a\u8fbc\u3080\u30d6\u30e9\u30f3\u30c1\u306eHEAD\u3060\u3063\u305fcommit\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>\u30de\u30fc\u30b8\u3055\u308c\u305f\u6642\u70b9\u306e\u72b6\u614b\r\n<\/code><\/pre>\n<h4>\u5408\u5e76\u7684\u7c7b\u578b<\/h4>\n<p>\u5408\u5e76\u64cd\u4f5c\u6709\u5feb\u8fdb\u548c\u975e\u5feb\u8fdb\u4e24\u79cd\u9009\u9879\u3002<\/p>\n<h5>\u5408\u5e76\uff08\u5feb\u8fdb\uff09<\/h5>\n<p>\u56e0\u4e3a\u5206\u5c94\u4e4b\u540e\uff0c\u5176\u4e2d\u4e00\u65b9\u6ca1\u6709\u524d\u8fdb\uff0c\u6240\u4ee5\u5feb\u8fdb\u4e0d\u4f1a\u53d1\u751f\u51b2\u7a81\u3002<br \/>\n\u5b9e\u9645\u4e0a\uff0c\u5b83\u4eec\u5e76\u672a\u771f\u6b63\u5408\u5e76\uff0c\u6240\u4ee5\u53ea\u6709\u4e00\u4e2a\u7236\u6bcd\u3002<\/p>\n<p>\u53ea\u6709\u8fdb\u884c\u63d0\u4ea4(\u4e0d\u4f1a\u521b\u5efa\u5408\u5e76\u63d0\u4ea4\uff1d\u6ca1\u6709\u201c\u5408\u5e76\u5206\u652f\u201d\u7684\u5386\u53f2\u8bb0\u5f55\u6b8b\u7559)\u3002<br \/>\n\u7ed3\u679c\u4e0e\u76f4\u63a5\u5411\u539f\u6765\u7684\u5206\u652f\u63d0\u4ea4\u6ca1\u6709\u533a\u522b\u3002(\u540e\u7eed\u53d8\u5f97\u96be\u4ee5\u64a4\u9500\u3002)<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/524-0.png\" alt=\"2-11-1.png\" \/><\/div>\n<h5>\u5408\u5e76\uff08\u975e\u5feb\u8fdb\u5f0f\uff09<\/h5>\n<p>\u5c06\u5408\u5e76\u540e\u7684\u5185\u5bb9\u4f5c\u4e3a\u63d0\u4ea4\u4fe1\u606f\u4fdd\u5b58\u3002<br \/>\n\u7531\u4e8e\u8fdb\u884c\u4e86\u5206\u652f\u5e76\u4e14\u4e24\u4e2a\u5206\u652f\u90fd\u5728\u4e0d\u540c\u65b9\u5411\u4e0a\u8fdb\u884c\u4e86\u8fdb\u5c55\uff0c\u53ef\u80fd\u4f1a\u53d1\u751f\u51b2\u7a81\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/527-0.png\" alt=\"2-11-2.png\" \/><\/div>\n<h4>\u53d6\u6d88\u5408\u5e76<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30de\u30fc\u30b8\u304c\u5b8c\u4e86\u3057\u305f\u5f8c\u304b\u3089\u53d6\u308a\u6d88\u3059\r\n<\/span><span class=\"gp\">$<\/span> git reset <span class=\"nt\">--hard<\/span> ORIG_HEAD\r\n<\/code><\/pre>\n<h4>\u5207\u6362\u63d0\u4ea4\u5386\u53f2<\/h4>\n<p>\u5c06\u5206\u5c90\u7684branch\u4e0e\u53e6\u4e00\u65b9\u8fde\u63a5\u8d77\u6765\uff08\u5728\u63d0\u4ea4\u65e5\u5fd7\u4e2d\uff0c\u5b83\u4f1a\u4fdd\u7559\u5728rebase\u4e4b\u524d\u7684\u65f6\u95f4\u6233\uff0c\u4f46\u4e0e\u6b64\u65e0\u5173\uff0c\u5b83\u4f1a\u5728\u5176\u540e\u9762\uff09\u3002<br \/>\n\u8fde\u63a5\u7684commit\u4f1a\u53d7\u5230\u4ee5\u524d\u7684\u5f71\u54cd\uff0c\u56e0\u6b64\u5b83\u7684\u54c8\u5e0c\u4f1a\u6539\u53d8\u3002<br \/>\n\u5f53\u524d\u7684\u5206\u652f\u540d\u79f0\uff08\u88ab\u66ff\u6362\u7684\u5206\u652f\u540d\u79f0\uff09\u5c06\u88ab\u4fdd\u7559\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/532-0.png\" alt=\"2-11-3.png\" \/><\/div>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/2\u3064\u306ebranch\u304c\u5206\u5c90\u3057\u305fcommit\u306e\u30cf\u30c3\u30b7\u30e5\u306e\u78ba\u8a8d\r\n<\/span><span class=\"gp\">$<\/span> git merge-base \u30d6\u30e9\u30f3\u30c1\u540d1 \u30d6\u30e9\u30f3\u30c1\u540d2\t\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ea\u30d9\u30fc\u30b9\u3092\u5229\u7528\u3057\u3066\u73fe\u5728\u306ebranch\u3092\u7279\u5b9a\u306ebranch\u306b\u4ed8\u3051\u66ff\u3048\u308b\r\n<\/span><span class=\"gp\">$<\/span> git rebase \u4ed8\u3051\u66ff\u3048\u5148\u306e\u30d6\u30e9\u30f3\u30c1\u540d\t\r\n<span class=\"go\">\r\n\/\/\u30ea\u30d9\u30fc\u30b9\u3092\u5229\u7528\u3057\u3066\u73fe\u5728\u306e\u30d6\u30e9\u30f3\u30c1\u3092\u7279\u5b9a\u306ebranch\u306b\u4ed8\u3051\u66ff\u3048\u308b(\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u30e2\u30fc\u30c9)\r\n<\/span><span class=\"gp\">$<\/span> git rebase <span class=\"nt\">--interactive<\/span> \u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"gp\">$<\/span> git rebase i \u30d6\u30e9\u30f3\u30c1\u540d\r\n<\/code><\/pre>\n<p>\u8bf7\u7528\u4e2d\u6587\u590d\u8ff0\u4e0b\u5217\u5185\u5bb9\uff0c\u53ea\u9700\u8981\u7ed9\u51fa\u4e00\u79cd\u9009\u9879\uff1a<\/p>\n<p>The cat is sleeping under the table.<\/p>\n<h4>\u4fee\u6539\u63d0\u4ea4\u5386\u53f2<\/h4>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/537-0.png\" alt=\"2-11-4.png\" \/><\/div>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30b3\u30df\u30c3\u30c8\u5c65\u6b74\u3092\u6539\u5909\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git rebase <span class=\"nt\">-i<\/span> \u6539\u5909\u3057\u305f\u3044\u4e00\u756a\u53e4\u3044commit\u3088\u308a1\u3064\u53e4\u3044commit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<p>\u5bf9\u6bcf\u4e2a\u63d0\u4ea4\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<div>\n<div class=\"post-table\">\u9078\u629e\u80a2rebase\u306e\u5404\u30b3\u30df\u30c3\u30c8\u3078\u306e\u64cd\u4f5cpick\u305d\u306e\u307e\u307ereword\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u7de8\u96c6edit\u30b3\u30df\u30c3\u30c8\u5185\u5bb9\u306e\u7de8\u96c6squash\u76f4\u524d\u306e\u30b3\u30df\u30c3\u30c8\u3068\u307e\u3068\u3081\u308b(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u7de8\u96c6)fixup\u76f4\u524d\u306e\u30b3\u30df\u30c3\u30c8\u3068\u307e\u3068\u3081\u308b(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u7834\u68c4)drop\u30b3\u30df\u30c3\u30c8\u306e\u524a\u9664<\/div>\n<\/div>\n<h5>\u5f53\u4f7f\u7528rebase\u65f6\u53d1\u751f\u51b2\u7a81\u65f6<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30ea\u30d9\u30fc\u30b9\u6642\u306e\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u89e3\u6d88\u3092\u4e2d\u6b62\r\n<\/span><span class=\"gp\">$<\/span> git rebase <span class=\"nt\">--abort<\/span>\r\n<span class=\"go\"> \r\n\/\/\u30ea\u30d9\u30fc\u30b9\u6642\u306e\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u89e3\u6d88\u7d42\u4e86\u6642\u306b\u4f7f\u7528\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git rebase <span class=\"nt\">--continue<\/span>\r\n<\/code><\/pre>\n<h5>\u64a4\u9500 rebase<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u623b\u308a\u305f\u3044\u6642\u70b9\u3092\u78ba\u8a8d\u3059\u308b \r\n<\/span><span class=\"gp\">$<\/span> git reflog\r\n<span class=\"go\">\r\n\/\/\u623b\u3059\r\n<\/span><span class=\"gp\">$<\/span> git reset <span class=\"nt\">--hard<\/span> HEAD@<span class=\"o\">{<\/span>n<span class=\"o\">}<\/span>\r\n<\/code><\/pre>\n<h4>\u6311\u9009\u7cbe\u9009\u7684<\/h4>\n<p>\u5bfc\u5165\u7279\u5b9a\u7684commit\u3002<br \/>\n\u4e0e\u5dee\u5f02\u4e0d\u540c\uff0c\u8fd9\u662f\u4e00\u4e2a\u5feb\u7167\uff0c\u56e0\u6b64\u5bfc\u5165\u7684\u662fcommit\u65f6\u7684\u72b6\u6001\uff0c\u800c\u4e0d\u662fcommit\u6240\u505a\u7684\u66f4\u6539\u3002<br \/>\n\u6307\u5b9a\u7684commit\u5c06\u5728cherry-pick\u4e4b\u540e\u6dfb\u52a0\u5230\u5f53\u524dHEAD\uff0c\u5e76\u4e14HEAD\u5c06\u524d\u8fdb\u3002<br \/>\n\u6dfb\u52a0\u7684commit\u54c8\u5e0c\u503c\u5c06\u6539\u53d8\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/547-0.png\" alt=\"2-11-5.png\" \/><\/div>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u7279\u5b9a\u306ecommit\u6642\u70b9\u306e\u72b6\u614b\u3092\u53d6\u308a\u8fbc\u3080\r\n<\/span><span class=\"gp\">$<\/span> git cherry-pick \u53d6\u308a\u8fbc\u3080commit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"gp\">$<\/span> git cherry-pick \u30d6\u30e9\u30f3\u30c1\u540d\r\n<span class=\"go\">\r\n\/\/\u8907\u6570\u306ecommit\u3092\u307e\u3068\u3081\u3066cherry-pick\u3059\u308b(\u9023\u7d9a\u3057\u3066\u3044\u308b\u5834\u5408)\r\n<\/span><span class=\"gp\">$<\/span> git cherry-pick \u53d6\u308a\u8fbc\u3080commit\u306e\u30cf\u30c3\u30b7\u30e5..\u53d6\u308a\u8fbc\u3080commit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\">\r\n\/\/\u8907\u6570\u306ecommit\u3092\u307e\u3068\u3081\u3066cherry-pick\u3059\u308b(\u9023\u7d9a\u3057\u3066\u3044\u306a\u3044\u5834\u5408)\r\n<\/span><span class=\"gp\">$<\/span> git cherry-pick \u53d6\u308a\u8fbc\u3080commit\u306e\u30cf\u30c3\u30b7\u30e51 \u53d6\u308a\u8fbc\u3080commit\u306e\u30cf\u30c3\u30b7\u30e52 \u53d6\u308a\u8fbc\u3080commit\u306e\u30cf\u30c3\u30b7\u30e53 \r\n<\/code><\/pre>\n<h5>\u5982\u679c\u53d1\u751f\u51b2\u7a81<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u30c1\u30a7\u30ea\u30fc\u30d4\u30c3\u30af\u6642\u306e\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u89e3\u6d88\u4f5c\u696d\u3092\u7d42\u4e86\u3059\u308b(\u6b21\u306b\u3059\u3059\u3080)\r\n<\/span><span class=\"gp\">$<\/span> git cherry-pick <span class=\"nt\">--continue<\/span>\r\n<span class=\"go\">\r\n\/\/\u30c1\u30a7\u30ea\u30fc\u30d4\u30c3\u30af\u6642\u306e\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u89e3\u6d88\u4f5c\u696d\u3092\u4e2d\u6b62\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git cherry-pick <span class=\"nt\">--abort<\/span>\r\n<\/code><\/pre>\n<h5>\u53d6\u6d88\u6311\u62e3\u6a31\u6843<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/cherry-pick\u306e\u53d6\u308a\u6d88\u3057\r\n<\/span><span class=\"gp\">$<\/span> git reset <span class=\"nt\">--hard<\/span> HEAD~\r\n<\/code><\/pre>\n<h4>\u53d6\u6d88commit<\/h4>\n<p>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684commit\u6765\u64a4\u9500\u7279\u5b9a\u7684commit\uff0c\u5e76\u64a4\u9500\u8be5commit\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/555-0.png\" alt=\"2-11-5.png\" \/><\/div>\n<h5>\u5982\u679c\u53ea\u6709\u4e00\u4e2a\u7236\u63d0\u4ea4<\/h5>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/HEAD\u306ecommit\u3092\u6253\u3061\u6d88\u3059(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u7de8\u96c6\u3059\u308b)\r\n<\/span><span class=\"gp\">$<\/span> git revert HEAD\r\n<span class=\"go\">\r\n\/\/\u7279\u5b9a\u306ecommit\u3092\u6253\u3061\u6d88\u3059(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u7de8\u96c6\u3059\u308b)\r\n<\/span><span class=\"gp\">$<\/span> git revert \u6253\u3061\u6d88\u3057\u305f\u3044commit\u306e\u30cf\u30c3\u30b7\u30e5 \r\n<span class=\"go\">\r\n\/\/HEAD\u306ecommit\u3092\u6253\u3061\u6d88\u3059(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u7de8\u96c6\u3057\u306a\u3044)\r\n<\/span><span class=\"gp\">$<\/span> git revert HEAD <span class=\"nt\">--no-edit<\/span>\r\n<span class=\"go\">\r\n\/\/\u7279\u5b9a\u306ecommit\u3092\u6253\u3061\u6d88\u3059(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u7de8\u96c6\u3057\u306a\u3044)\r\n<\/span><span class=\"gp\">$<\/span> git revert \u6253\u3061\u6d88\u3057\u305f\u3044commit\u306e\u30cf\u30c3\u30b7\u30e5 <span class=\"nt\">--no-edit<\/span>\r\n<\/code><\/pre>\n<p>\u6267\u884crevert\u547d\u4ee4\u540e\uff0c\u5c06\u8fdb\u5165\u7f16\u8f91\u63d0\u4ea4\u4fe1\u606f\u7684\u754c\u9762\uff0c\u9700\u5728\u6b64\u8f93\u5165\u3002<\/p>\n<h5>\u5982\u679c\u7236\u6bcd\u662f\u591a\u4e2a\u63d0\u4ea4\u7684\u60c5\u51b5\u4e0b<\/h5>\n<p>\u4e00\u4e2a\u5177\u6709\u591a\u4e2a\u7236\u9879\u7684commit\u5bf9\u8c61\u7684\u4f8b\u5b50\u662f\u5408\u5e76\u63d0\u4ea4\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\"> \/\/\u89aa\u304c\u8907\u6570\u3042\u308b\u5834\u5408\u306f\u3001\u89aa\u3092\u6307\u5b9a\u3059\u308b\u305f\u3081\u306e-m\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u5fc5\u8981\r\n error: commit \u6253\u3061\u6d88\u305d\u3046\u3068\u3057\u305fcommit\u30aa\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5 is a merge but no -m option was given.\r\n<\/span><\/code><\/pre>\n<p>\u786e\u8ba4\u76ee\u6807\u5408\u5e76\u63d0\u4ea4\uff0c\u5c06\u7b2c\u4e00\u4e2a\u5199\u7684\u6807\u8bb0\u4e3a1\uff0c\u7b2c\u4e8c\u4e2a\u5199\u7684\u6807\u8bb0\u4e3a2\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git revert <span class=\"nt\">-m<\/span> 1 \u6253\u3061\u6d88\u3057\u305f\u3044commit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/code><\/pre>\n<h5>\u5bb6\u4eba\u7684\u8eab\u4efd\u6838\u5b9e\u65b9\u5f0f<\/h5>\n<p>\u5982\u679c\u8981\u901a\u8fc7git show\u786e\u8ba4\u7684\u8bdd<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git show\r\n<span class=\"go\">\r\ncommit commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\nMerge: \u89aa1\u306ecommit\u306e\u30cf\u30c3\u30b7\u30e5(7\u6841)  \u89aa2\u306ecommit\u306e\u30cf\u30c3\u30b7\u30e5(7\u6841)\r\n<\/span><span class=\"gp\">Author: \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span>\r\n<span class=\"go\">Date:   \u66dc\u65e5 \u6708 \u65e5 \u6642\u523b \u5e74 +0900\r\n<\/span><\/code><\/pre>\n<p>\u5982\u679c\u8981\u901a\u8fc7 git cat-file \u8fdb\u884c\u786e\u8ba4\u7684\u8bdd\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git cat-file <span class=\"nt\">-p<\/span> commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e540\u6841\r\n<span class=\"go\">\r\ntree trree\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\nparent \u89aa1\u306ecommit\u306e\u30cf\u30c3\u30b7\u30e5\r\nparent \u89aa2\u306ecommit\u306e\u30cf\u30c3\u30b7\u30e5\r\n<\/span><span class=\"gp\">author \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span> UNIX\u6642\u9593 +0900\r\n<span class=\"gp\">committer \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span> UNIX\u6642\u9593 +0900\r\n<span class=\"go\">\r\n\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/span><\/code><\/pre>\n<p>\u5982\u679c\u8981\u5728git\u65e5\u5fd7\u4e2d\u8fdb\u884c\u786e\u8ba4<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">commit commit\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30cf\u30c3\u30b7\u30e540\u6841\r\nMerge: \u89aa1\u306ecommit\u306e\u30cf\u30c3\u30b7\u30e5(7\u6841)  \u89aa2\u306ecommit\u306e\u30cf\u30c3\u30b7\u30e5(7\u6841)\r\n<\/span><span class=\"gp\">Author: \u30e6\u30fc\u30b6\u30fc\u540d &lt;\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&gt;<\/span>\r\n<span class=\"go\">Date:   \u66dc\u65e5 \u6708 \u65e5 \u6642\u523b \u897f\u66a6 +0900\r\n\r\n\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\r\n<\/span><\/code><\/pre>\n<h5>\u8bf7\u505c\u6b62\u5728\u63d0\u4ea4\u4e4b\u524d\u8fdb\u884c\u5426\u5b9a\u548c\u751f\u6210\u6253\u6d88\u3002<\/h5>\n<p>\u5728\u64a4\u9500\u591a\u4e2acommit\u6216\u8005\u5408\u5e76\u591a\u4e2acommit\u65f6\u4f7f\u7528\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gp\">$<\/span> git revert \u6253\u3061\u6d88\u3057\u305f\u3044\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5 <span class=\"nt\">--no-commit<\/span>\r\n<span class=\"gp\">$<\/span> git revert \u6253\u3061\u6d88\u3057\u305f\u3044\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5 <span class=\"nt\">-n<\/span>\r\n<\/code><\/pre>\n<h4>\u5220\u9664\u591a\u4e2acommit<\/h4>\n<p>\u6bcf\u6b21\u53d6\u6d88commit\uff0c\u5c31\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684commit\u3002\uff08\u6309\u7167\u4ece\u6700\u65b0\u7684\u5f00\u59cb\u53d6\u6d88\u3002\uff09<\/p>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/\u8907\u6570\u306ecommit\u3092revert\u3059\u308b(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u7de8\u96c6\u3059\u308b) HEAD\u3067\u306e\u6307\u5b9a\r\n<\/span><span class=\"gp\">$<\/span> git revert HEAD<span class=\"o\">(<\/span>\u6253\u3061\u6d88\u3059\u4e2d\u3067\u6700\u65b0\u306e\u30b3\u30df\u30c3\u30c8<span class=\"o\">)<\/span>...HEAD~n<span class=\"o\">(<\/span>\u6253\u3061\u6d88\u3057\u305f\u3044\u4e00\u756a\u53e4\u3044\u30b3\u30df\u30c3\u30c8\u3088\u308a\u4e00\u3064\u53e4\u3044<span class=\"o\">)<\/span>\r\n<span class=\"go\">\r\n\/\/\u8907\u6570\u306ecommit\u3092revert\u3059\u308b(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u7de8\u96c6\u3059\u308b) commit\u306e\u30cf\u30c3\u30b7\u30e5\u3067\u306e\u6307\u5b9a\r\n<\/span><span class=\"gp\">$<\/span> git revert \u6253\u3061\u6d88\u3059\u4e2d\u3067\u6700\u65b0\u306e\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5...\u6253\u3061\u6d88\u3059\u6700\u5f8c\u306e\u30b3\u30df\u30c3\u30c8\u3088\u308a\u4e00\u3064\u53e4\u3044\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\">\r\n\r\n\/\/\u8907\u6570\u306ecommit\u3092revert\u3059\u308b(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u7de8\u96c6\u3057\u306a\u3044) HEAD\u3067\u306e\u6307\u5b9a\r\n<\/span><span class=\"gp\">$<\/span> git revert HEAD<span class=\"o\">(<\/span>\u6253\u3061\u6d88\u3059\u4e2d\u3067\u6700\u65b0\u306e\u30b3\u30df\u30c3\u30c8<span class=\"o\">)<\/span>...HEAD~n<span class=\"o\">(<\/span>\u6253\u3061\u6d88\u3057\u305f\u3044\u4e00\u756a\u53e4\u3044\u30b3\u30df\u30c3\u30c8\u3088\u308a\u4e00\u3064\u53e4\u3044<span class=\"o\">)<\/span> <span class=\"nt\">--no-edit<\/span>\r\n<span class=\"go\">\r\n\/\/\u8907\u6570\u306ecommit\u3092revert\u3059\u308b(\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u7de8\u96c6\u3057\u306a\u3044) commit\u306e\u30cf\u30c3\u30b7\u30e5\u3067\u306e\u6307\u5b9a\r\n<\/span><span class=\"gp\">$<\/span> git revert \u6253\u3061\u6d88\u3059\u4e2d\u3067\u6700\u521d\u306e\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5...\u6253\u3061\u6d88\u3059\u6700\u5f8c\u306e\u30b3\u30df\u30c3\u30c8\u3088\u308a\u4e00\u3064\u53e4\u3044\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5 <span class=\"nt\">--no-edit<\/span>\r\n<\/code><\/pre>\n<h4>\u6253\u7834\u6253\u6d88\u5426\u5b9a<\/h4>\n<pre class=\"post-pre\"><code><span class=\"go\">\/\/revert\u3067\u4f5c\u6210\u3057\u305fcommit\u3092revert\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git revert \u7279\u5b9a\u306e\u30b3\u30df\u30c3\u30c8\u306e\u30cf\u30c3\u30b7\u30e5\r\n<span class=\"go\">\r\n\/\/revert\u3067\u4f5c\u6210\u3057\u305fcommit\u3092\u524a\u9664\u3059\u308b\r\n<\/span><span class=\"gp\">$<\/span> git reset <span class=\"nt\">--hard<\/span> HEAD~n\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148 \u6211\u4e0d\u61c2Git\u3002 \u4e3a\u4ec0\u4e48\u641e\u4e0d\u61c2\u5462\uff1f \u89e3\u51b3\u65b9\u6848\u53ef\u80fd\u4e3a\uff1a\u901a\u8fc7\u67e5\u770b.git\/\u76ee\u5f55\uff0c\u53ef\u4ee5\u5c06\u5176\u89c6\u4e3a\u6587\u4ef6\u66f4\u6539\uff0c\u4ece\u800c\u786e\u8ba4 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-37442","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6211\u5bf9Git\u4e00\u65e0\u6240\u77e5 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u5bf9git\u4e00\u65e0\u6240\u77e5\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6211\u5bf9Git\u4e00\u65e0\u6240\u77e5\" \/>\n<meta property=\"og:description\" content=\"\u9996\u5148 \u6211\u4e0d\u61c2Git\u3002 \u4e3a\u4ec0\u4e48\u641e\u4e0d\u61c2\u5462\uff1f \u89e3\u51b3\u65b9\u6848\u53ef\u80fd\u4e3a\uff1a\u901a\u8fc7\u67e5\u770b.git\/\u76ee\u5f55\uff0c\u53ef\u4ee5\u5c06\u5176\u89c6\u4e3a\u6587\u4ef6\u66f4\u6539\uff0c\u4ece\u800c\u786e\u8ba4 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u5bf9git\u4e00\u65e0\u6240\u77e5\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-17T12:26:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-04T07:43:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/100-2.png\" \/>\n<meta name=\"author\" content=\"\u65b0, \u97f5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u65b0, \u97f5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/\",\"name\":\"\u6211\u5bf9Git\u4e00\u65e0\u6240\u77e5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-03-17T12:26:11+00:00\",\"dateModified\":\"2024-05-04T07:43:06+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6211\u5bf9Git\u4e00\u65e0\u6240\u77e5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\",\"name\":\"\u65b0, \u97f5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"caption\":\"\u65b0, \u97f5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u6211\u5bf9Git\u4e00\u65e0\u6240\u77e5 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u5bf9git\u4e00\u65e0\u6240\u77e5\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"\u6211\u5bf9Git\u4e00\u65e0\u6240\u77e5","og_description":"\u9996\u5148 \u6211\u4e0d\u61c2Git\u3002 \u4e3a\u4ec0\u4e48\u641e\u4e0d\u61c2\u5462\uff1f \u89e3\u51b3\u65b9\u6848\u53ef\u80fd\u4e3a\uff1a\u901a\u8fc7\u67e5\u770b.git\/\u76ee\u5f55\uff0c\u53ef\u4ee5\u5c06\u5176\u89c6\u4e3a\u6587\u4ef6\u66f4\u6539\uff0c\u4ece\u800c\u786e\u8ba4 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u6211\u5bf9git\u4e00\u65e0\u6240\u77e5\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-03-17T12:26:11+00:00","article_modified_time":"2024-05-04T07:43:06+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d2e6037434c4406c54154\/100-2.png"}],"author":"\u65b0, \u97f5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u65b0, \u97f5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"13 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/","name":"\u6211\u5bf9Git\u4e00\u65e0\u6240\u77e5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-03-17T12:26:11+00:00","dateModified":"2024-05-04T07:43:06+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u6211\u5bf9Git\u4e00\u65e0\u6240\u77e5"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9","name":"\u65b0, \u97f5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","caption":"\u65b0, \u97f5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%88%91%e5%af%b9git%e4%b8%80%e6%97%a0%e6%89%80%e7%9f%a5%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=37442"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37442\/revisions"}],"predecessor-version":[{"id":99211,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37442\/revisions\/99211"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=37442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=37442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=37442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}