{"id":37781,"date":"2023-08-29T08:49:11","date_gmt":"2023-05-01T00:20:13","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/"},"modified":"2024-04-30T20:34:12","modified_gmt":"2024-04-30T12:34:12","slug":"git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/","title":{"rendered":"git\u7406\u89e3\u7b14\u8bb0"},"content":{"rendered":"<h2>\u9996\u5148<\/h2>\n<p>\u4ee5\u524d\u53ea\u662f\u7b80\u5355\u5730\u4f7f\u7528\u4e86\u4e00\u4e9b\u547d\u4ee4\uff0c\u6bd4\u5982add\u3001commit\u3001push\u548cpull\uff0c\u5bf9\u4e8e\u5b83\u4eec\u7684\u7406\u89e3\u8fd8\u5f88\u6d45\u663e\u3002\u4f46\u7531\u4e8e\u8981\u653e\u5f03\u4f7f\u7528svn\u5e76\u5f00\u59cb\u4f7f\u7528git\uff0c\u6240\u4ee5\u6211\u5c06\u5b66\u5230\u7684\u5185\u5bb9\u6574\u7406\u6210\u4e86\u5907\u5fd8\u5f55\u3002<\/p>\n<p>\u5982\u679c\u6709\u9519\u8bef\u6216\u8005\u9700\u8981\u8865\u5145\u7684\u5730\u65b9\uff0c\u8bf7\u52a1\u5fc5\u7559\u8a00\u544a\u8bc9\u6211 mm\u3002<\/p>\n<p>\u518d\u8bf4\u4e00\u904d\uff0c\u5982\u679c\u65b9\u4fbf\u7684\u8bdd\uff0c\u6211\u4e5f\u5199\u4e86\u4e00\u7bc7\u5173\u4e8e\u8bbe\u7f6e\u7684\u6587\u7ae0\uff0c\u4e00\u8d77\u6765\u8ba9git\u66f4\u65b9\u4fbf\u5427\u3002\u5907\u5fd8\u3002<\/p>\n<h2>\u7d22\u5f15<\/h2>\n<p>\u4e0esvn\u7684\u4e0d\u540c<br \/>\n\u5927\u81f4\u7684\u6982\u5ff5\u56fe<br \/>\n\u6bcf\u4e2a\u64cd\u4f5c\u7684\u5904\u7406\u6d41\u7a0b\uff08\u5927\u81f4\uff09<br \/>\n\u5f00\u59cb\u7ba1\u7406\u65b0\u9879\u76ee<br \/>\n\u786e\u8ba4\u5df2\u66f4\u6539\u7684\u6587\u4ef6<br \/>\n\u5c06\u66f4\u6539\u540e\u7684\u6587\u4ef6\u540c\u6b65\u5230\u8fdc\u7a0b<br \/>\n\u4ece\u8fdc\u7a0b\u83b7\u53d6\u65b0\u7684\u63d0\u4ea4\u5185\u5bb9<br \/>\n\u547d\u4ee4\u89e3\u91ca<\/p>\n<div>\n<div class=\"post-table\">\n<p><a href=\"#clone\">clone<\/a><a href=\"#init\">init<\/a><a href=\"#remote\">remote<\/a><a href=\"#status\">status<\/a><a href=\"#diff\">diff<\/a><a href=\"#log\">log<\/a><a href=\"#add\">add<\/a><a href=\"#rm\">rm<\/a><a href=\"#mv\">mv<\/a><a href=\"#commit\">commit<\/a><a href=\"#reset\">reset<\/a><a href=\"#push\">push<\/a><a href=\"#fetch\">fetch<\/a><a href=\"#merge\">merge<\/a><a href=\"#rebase\">rebase<\/a><a href=\"#pull\">pull<\/a><a href=\"#branch\">branch<\/a><a href=\"#checkout\">checkout<\/a><a href=\"#stash\">stash<\/a><a href=\"#show\">show<\/a><strong><a href=\"#%E7%94%A8%E8%AA%9E%E8%A7%A3%E8%AA%AC\">\u7528\u8a9e\u89e3\u8aac<\/a><\/strong><\/p>\n<p><a href=\"#head%E3%81%A8%E3%81%AF\">HEAD<\/a><\/p>\n<p><a href=\"#sha-1%E3%81%A8%E3%81%AF\">SHA-1<\/a><\/p>\n<p><a href=\"#%E4%B8%8A%E6%B5%81%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81upstream-branch%E3%81%A8%E3%81%AF\">\u4e0a\u6d41\u30d6\u30e9\u30f3\u30c1\uff08Upstream branch\uff09<\/a><\/p>\n<p><a href=\"#%E3%83%AA%E3%83%A2%E3%83%BC%E3%83%88%E8%BF%BD%E8%B7%A1%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81%E3%81%A8%E3%81%AF\">\u30ea\u30e2\u30fc\u30c8\u8ffd\u8de1\u30d6\u30e9\u30f3\u30c1<\/a><\/p>\n<p><a href=\"#detached-head%E3%81%A8%E3%81%AF\">detached HEAD<\/a><\/p>\n<p><a href=\"#%E3%83%97%E3%83%AB%E3%83%AA%E3%82%AF%E3%82%A8%E3%82%B9%E3%83%88%E3%81%A8%E3%81%AF\">\u30d7\u30eb\u30ea\u30af\u30a8\u30b9\u30c8<\/a><\/p>\n<p><strong><a href=\"#%E3%81%8A%E3%82%8F%E3%82%8A%E3%81%AB\">\u304a\u308f\u308a\u306b<\/a><\/strong><\/p>\n<p><strong><a href=\"#%E5%8F%82%E8%80%83%E8%B3%87%E6%96%99\">\u53c2\u8003\u8cc7\u6599<\/a><\/strong><\/p>\n<\/div>\n<\/div>\n<h2>\u4e0esvn\u7684\u4e0d\u540c\u4e4b\u5904<\/h2>\n<p>\u5728SVN\u4e2d\uff0c\u5f53\u63d0\u4ea4\u65f6\u4f1a\u76f4\u63a5\u53d1\u9001\u5230\u5b58\u50a8\u5e93\u4e2d\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/9-0.png\" alt=\"image.png\" \/><\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/10-0.png\" alt=\"image.png\" \/><\/div>\n<h2>\u7c97\u7565\u7684\u6982\u5ff5\u56fe<\/h2>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/12-0.png\" alt=\"image.png\" \/><\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/13-0.png\" alt=\"image.png\" \/><\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/14-0.png\" alt=\"image.png\" \/><\/div>\n<h4>\u6307\u6570<\/h4>\n<p>\u5728\u63d0\u4ea4\u4e4b\u524d\uff0c\u6709\u4e00\u4e2a\u5c06\u6587\u4ef6\u653e\u5165\u7d22\u5f15\u7684\u673a\u5236\u3002<\/p>\n<p>\u7d22\u5f15\u662f\u51c6\u5907\u63d0\u4ea4\u7684\u5730\u65b9\uff0c\u53ea\u6709\u88ab\u767b\u8bb0\u5728\u8fd9\u4e2a\u7d22\u5f15\u4e2d\u7684\u6587\u4ef6\u624d\u4f1a\u88ab\u63d0\u4ea4\u3002<\/p>\n<p>\u6362\u53e5\u8bdd\u8bf4\uff0c\u4e0d\u9700\u8981\u63d0\u4ea4\u7684\u6587\u4ef6\u5982\u679c\u4e0d\u5728\u7d22\u5f15\u4e2d\u6ce8\u518c\uff0c\u5219\u65e0\u6cd5\u63d0\u4ea4\uff0c\u56e0\u6b64\u975e\u5fc5\u987b\u63d0\u4ea4\u7684\u6587\u4ef6\u7ba1\u7406\u66f4\u52a0\u4fbf\u6377\u3002<\/p>\n<h2>\u5904\u7406\u6bcf\u4e2a\u4f5c\u4e1a\u7684\u6d41\u7a0b\uff08\u7b80\u7565\uff09<\/h2>\n<h3>\u5f00\u59cb\u65b0\u7684\u7ba1\u7406\u5de5\u4f5c<\/h3>\n<h5>\u5728\u514b\u9686\u65b9\u9762\u7684\u65b9\u6cd5<\/h5>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5728Github\u3001Bitbucket\u3001GitLab\u7b49Git\u6258\u7ba1\u670d\u52a1\u4e0a\u521b\u5efa\u4ed3\u5e93<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u4f7f\u7528git clone\u547d\u4ee4\u5c06\u4ed3\u5e93\u514b\u9686\u5230\u672c\u5730<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u203b\u6b64\u65f6\u4f1a\u521b\u5efa\u4e0e\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5173\u8054<\/ol>\n<h5>\u81ea\u5df1\u7d81\u5b9a\u7684\u65b9\u6cd5<\/h5>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5728GitHub\u3001Bitbucket\u3001GitLab\u7b49git\u6258\u7ba1\u670d\u52a1\u4e2d\uff0c<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u521b\u5efa\u5b58\u50a8\u5e93<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u51c6\u5907\u672c\u5730\u7ba1\u7406\u4f4d\u7f6e\uff08\u521b\u5efa\u76ee\u5f55\uff09<\/ol>\n<\/li>\n<\/ol>\n<p>\u901a\u8fc7git init\u521b\u5efagit\u7ba1\u7406\u914d\u7f6e\u6587\u4ef6\u7b49<\/p>\n<p>\u901a\u8fc7git remote add origin ${\u65b0\u5b58\u50a8\u5e93\u8def\u5f84}\u4e0e\u8fdc\u7a0b\u5b58\u50a8\u5e93\u5173\u8054<br \/>\nadd -&gt; commit -&gt; push\u6b65\u9aa4 *\u6709\u53e6\u5916\u7684\u89e3\u91ca<\/p>\n<h3>\u786e\u8ba4\u5df2\u66f4\u6539\u7684\u6587\u4ef6<\/h3>\n<p>git status\u306b\u3066\u5909\u66f4\u30d5\u30a1\u30a4\u30eb\u306a\u3069\u3092\u78ba\u8a8d<\/p>\n<p>git diff\u306b\u3066\u5909\u66f4\u5dee\u5206\u3092\u78ba\u8a8d<\/p>\n<h3>\u5c06\u66f4\u6539\u540e\u7684\u6587\u4ef6\u540c\u6b65\u5230\u8fdc\u7a0b\u7aef\u3002<\/h3>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5c06\u76ee\u6807\u6587\u4ef6\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5f53\u6240\u6709\u53d8\u66f4\u90fd\u5b8c\u6210\u540e\u8fdb\u884c\u63d0\u4ea4<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u5c06\u5df2\u63d0\u4ea4\u7684\u5185\u5bb9\u63a8\u9001\u5230\u8fdc\u7a0b\u670d\u52a1\u5668<\/ol>\n<h3>\u4ece\u8fdc\u7a0b\u83b7\u53d6\u65b0\u7684\u63d0\u4ea4\u5185\u5bb9<\/h3>\n<ol>\u6267\u884c fetch + merge \u6216 pull<\/ol>\n<h2>\u547d\u4ee4\u8bf4\u660e<\/h2>\n<h3>\u514b\u9686<\/h3>\n<p>\u590d\u5236\u539f\u59cb\u7248\u672c\u5e93\u5230\u6307\u5b9a\u7684\u76ee\u5f55\u7684\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>git clone [\u30af\u30ed\u30fc\u30f3\u3057\u305f\u3044\u30ea\u30dd\u30b8\u30c8\u30ea] [\u30af\u30ed\u30fc\u30f3\u5148\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea(\u7701\u7565\u53ef)]\r\n<\/code><\/pre>\n<p>\u5982\u679c\u7701\u7565\u514b\u9686\u76ee\u6807\uff0c\u5219\u4f1a\u751f\u6210\u4e0e\u8981\u514b\u9686\u7684\u4ed3\u5e93\u540c\u540d\u7684\u76ee\u5f55\u3002<\/p>\n<p>\u8bf7\u4f60\u5e2e\u6211\u4e00\u4e0b\u3002<br \/>\n\u8bf7\u5e2e\u6211\u4e00\u4e0b\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git clone https:\/\/github.com\/rytkmt\/dotfiles.git\r\n<\/code><\/pre>\n<hr \/>\n<h3>\u5f00\u59cb<\/h3>\n<p>\u6267\u884c\u7528\u4e8egit\u7ba1\u7406\u521d\u59cb\u5316\u7684\u547d\u4ee4\uff0c\u5c06\u751f\u6210\u4e00\u4e2a.git\u76ee\u5f55\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code>git init [\u521d\u671f\u5316\u3057\u305f\u3044\u30c7\u30a3\u30ec\u30af\u30c8\u30ea(\u7701\u7565\u53ef)]\r\n<\/code><\/pre>\n<p>\u5982\u679c\u7701\u7565\u76ee\u5f55\uff0c\u5219\u4e3a\u5f53\u524d\u76ee\u5f55\u3002<\/p>\n<hr \/>\n<h3>\u9065\u8fdc\u7684<\/h3>\n<p>\u6dfb\u52a0\u3001\u5220\u9664\u3001\u786e\u8ba4\u3001\u66f4\u6539\u8fdc\u7a0b\u5b58\u50a8\u5e93\u7684\u547d\u4ee4\u3002<\/p>\n<p>\u589e\u52a0<\/p>\n<pre class=\"post-pre\"><code>git remote add [\u8ffd\u52a0\u3059\u308b\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u540d] [\u8ffd\u52a0\u3057\u305f\u3044\u30ea\u30dd\u30b8\u30c8\u30ea]\r\n<\/code><\/pre>\n<p>\u5220\u9664<\/p>\n<pre class=\"post-pre\"><code>git remote rm [\u524a\u9664\u3057\u305f\u3044\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u540d]\r\n<\/code><\/pre>\n<p>\u786e\u8ba4<\/p>\n<pre class=\"post-pre\"><code>git remote\r\n<\/code><\/pre>\n<p>\u786e\u8ba4 (\u5305\u62ec URL)<\/p>\n<pre class=\"post-pre\"><code>git remote -v\r\n<\/code><\/pre>\n<p>\u4fee\u6539(url)<\/p>\n<pre class=\"post-pre\"><code>git remote set-url origin [\u5909\u66f4\u5148\u306eURL]\r\n<\/code><\/pre>\n<p>\u4fee\u6539\uff08\u5b58\u50a8\u5e93\u540d\u79f0\uff09<\/p>\n<pre class=\"post-pre\"><code>git remote rename [\u5909\u66f4\u524d\u30ea\u30dd\u30b8\u30c8\u30ea\u540d] [\u5909\u66f4\u5f8c\u30ea\u30dd\u30b8\u30c8\u30ea\u540d]\r\n<\/code><\/pre>\n<p>origin\u662f\u9ed8\u8ba4\u4f7f\u7528\u7684\u8fdc\u7a0b\u4ed3\u5e93\u540d\u79f0\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<p>Original: &#8220;I like to eat apples.&#8221;<br \/>\nParaphrase: &#8220;\u6211\u559c\u6b22\u5403\u82f9\u679c\u3002&#8221;<\/p>\n<p>Original: &#8220;She is studying English in university.&#8221;<br \/>\nParaphrase: &#8220;\u5979\u6b63\u5728\u5927\u5b66\u5b66\u4e60\u82f1\u6587\u3002&#8221;<\/p>\n<p>Original: &#8220;The weather is very hot today.&#8221;<br \/>\nParaphrase: &#8220;\u4eca\u5929\u5929\u6c14\u5f88\u70ed\u3002&#8221;<\/p>\n<p>Original: &#8220;I want to go to the park tomorrow.&#8221;<br \/>\nParaphrase: &#8220;\u6211\u660e\u5929\u60f3\u53bb\u516c\u56ed\u3002&#8221;<\/p>\n<p>Original: &#8220;He enjoys playing soccer with his friends.&#8221;<br \/>\nParaphrase: &#8220;\u4ed6\u559c\u6b22\u548c\u670b\u53cb\u4eec\u4e00\u8d77\u8e22\u8db3\u7403\u3002&#8221;<\/p>\n<pre class=\"post-pre\"><code>$ git remote\r\norigin\r\n$ git remote -v\r\norigin\thttps:\/\/github.com\/rytkmt\/dotfiles.git (fetch)\r\norigin\thttps:\/\/github.com\/rytkmt\/dotfiles.git (push)\r\n<\/code><\/pre>\n<hr \/>\n<h3>\u72b6\u6001<\/h3>\n<p>\u663e\u793a\u5de5\u4f5c\u533a\u7684\u72b6\u6001\u547d\u4ee4<br \/>\n\u663e\u793a\u4ee5\u4e0b\u6587\u4ef6\u7684\u8def\u5f84<\/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\u306b\u8ffd\u8de1\u3055\u308c\u3066\u3044\u306a\u3044\u3082\u306e\uff08\u307e\u3060add\u3057\u305f\u3053\u3068\u306a\u3044\uff09<\/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\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u9055\u3044\u304c\u3042\u308b\u3082\u306e\uff08add\u3057\u305f\u3082\u306e\u304b\u3089\u66f4\u306b\u5909\u66f4\u304c\u3042\u308b\uff09<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30b3\u30df\u30c3\u30c8\u3055\u308c\u305f\u3082\u306e\u3068\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u9055\u3044\u304c\u3042\u308b\u3082\u306e\uff08\u30b3\u30df\u30c3\u30c8\u3057\u3066\u304b\u3089add\u3055\u308c\u305f\uff09<\/ul>\n<h5>\u9009\u9879<\/h5>\n<p>&#8211;short<br \/>\n\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u3068\u3001\u7c21\u7565\u5316\u3057\u305f\u72b6\u614b\u306e\u30de\u30fc\u30af\u3067\u8868\u793a\u3055\u308c\u308b<\/p>\n<p>\u6709a.txt\u548cb.txt\u4e24\u4e2a\u6587\u4ef6\u3002<br \/>\n\u5982\u679c\u5c06a\u8fdb\u884c\u4fee\u6539\uff0cb\u8fdb\u884c\u5220\u9664\uff0c\u540c\u65f6\u521b\u5efac\u3002<\/p>\n<pre class=\"post-pre\"><code>$ git status\r\nOn branch master\r\nYour branch is up-to-date with 'origin\/master'.\r\n\r\nChanges to be committed:\r\n  (use \"git reset HEAD &lt;file&gt;...\" to unstage)\r\n\r\n\tdeleted:    b.txt\r\n\r\nChanges not staged for commit:\r\n  (use \"git add &lt;file&gt;...\" to update what will be committed)\r\n  (use \"git checkout -- &lt;file&gt;...\" to discard changes in working directory)\r\n\r\n\tmodified:   a.txt\r\n\r\nUntracked files:\r\n  (use \"git add &lt;file&gt;...\" to include in what will be committed)\r\n\r\n\tc.txt\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>$ git status --short\r\n M a.txt\r\nD  b.txt\r\n?? c.txt\r\n<\/code><\/pre>\n<hr \/>\n<h3>\u4e0d\u540c<\/h3>\n<p>\u7528\u4e8e\u663e\u793a\u6587\u4ef6\u66f4\u6539\u7684\u547d\u4ee4<\/p>\n<p>\u4ee5\u4e0b\u7684\u6307\u7684\u662f\u6307\u5b9aHEAD\u6216SHA-1\u7684\u4e8b\u9879\u3002<\/p>\n<p>\u663e\u793a\u5de5\u4f5c\u533a\u548c\u7d22\u5f15\u4e4b\u95f4\u7684\u533a\u522b<\/p>\n<pre class=\"post-pre\"><code>git diff\r\n<\/code><\/pre>\n<p>\u663e\u793a\u5de5\u4f5c\u6811\u548c\u7d22\u5f15\u4e2d\u7279\u5b9a\u6587\u4ef6\u7684\u5dee\u5f02<\/p>\n<pre class=\"post-pre\"><code>git diff [\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9]\r\n<\/code><\/pre>\n<p>\u663e\u793a\u5de5\u4f5c\u6811\u4e0e\u63d0\u4ea4\u4e4b\u95f4\u7684\u5dee\u5f02<\/p>\n<pre class=\"post-pre\"><code>git diff &lt;commit&gt;\r\n<\/code><\/pre>\n<p>\u663e\u793a\u63d0\u4ea4\u548c\u63d0\u4ea4\u4e4b\u95f4\u7684\u5dee\u5f02<\/p>\n<pre class=\"post-pre\"><code>git diff &lt;commit&gt; &lt;commit&gt;\r\n<\/code><\/pre>\n<p>\u663e\u793a\u63d0\u4ea4\u548c\u7279\u5b9a\u6587\u4ef6\u4e4b\u95f4\u7684\u5dee\u5f02<\/p>\n<pre class=\"post-pre\"><code>git diff &lt;commit&gt; &lt;commit&gt; [\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9]\r\n<\/code><\/pre>\n<h5>\u8bf7\u9009\u62e9\u4ee5\u4e0b\u7684\u9009\u9879<\/h5>\n<p>&#8211;cached<br \/>\n\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\uff08\u30b9\u30c6\u30fc\u30b8\u9818\u57df\uff09\u3078\u306e\u5909\u66f4\u3092\u898b\u308b\u3088\u3046\u306b\u306a\u308b<\/p>\n<p>\u5982\u679c\u7701\u7565\uff0c\u5b83\u6307\u7684\u662fHEAD\u3002<\/p>\n<p>\u663e\u793a\u7d22\u5f15\u548c\u63d0\u4ea4\u7684\u5dee\u5f02\uff08\u663e\u793a\u5df2\u6dfb\u52a0\/\u5220\u9664\u7684\u5185\u5bb9\u786e\u8ba4\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>git diff --chached &lt;commit&gt;\r\n<\/code><\/pre>\n<p>&#8211;name-only<br \/>\n\u30d5\u30a1\u30a4\u30eb\u540d\u3060\u3051\u3092\u6bd4\u8f03\u3059\u308b<\/p>\n<p>-b or &#8211;ignore-space-changes<br \/>\n\u30d5\u30a1\u30a4\u30eb\u5185\u306e\u30b9\u30da\u30fc\u30b9\u306e\u6570\u306e\u9055\u3044\u3092\u7121\u8996\u3059\u308b<\/p>\n<p>-w or &#8211;ignore-all-space<br \/>\n\u30d5\u30a1\u30a4\u30eb\u5185\u306e\u30b9\u30da\u30fc\u30b9\/\u6539\u884c\u30b3\u30fc\u30c9\u306e\u9055\u3044\u3092\u5b8c\u5168\u306b\u7121\u8996\u3059\u308b<\/p>\n<hr \/>\n<h3>\u8bb0\u5f55<\/h3>\n<p>\u5c55\u793a\u63d0\u4ea4\u65e5\u5fd7<\/p>\n<pre class=\"post-pre\"><code>$ git log\r\nWARNING: terminal is not fully functional\r\ncommit e2d910d83280beb81e9196ce291b1c97437540c4 (HEAD -&gt; master)\r\nAuthor: rytkmt &lt;r12tkmt@gmail.com&gt;\r\nDate:   Tue Feb 26 14:03:52 2019 +0900\r\n\r\n    Mofify a\r\n\r\ncommit 7ce41173f6dc7312f812102818517d3a658136c7\r\nMerge: d461a70 8c697e8\r\nAuthor: rytkmt &lt;r12tkmt@gmail.com&gt;\r\nDate:   Tue Feb 26 13:44:48 2019 +0900\r\n\r\n    Merge\r\n<\/code><\/pre>\n<h5>\u9009\u9879<\/h5>\n<p>&#8211;oneline<br \/>\n1\u30b3\u30df\u30c3\u30c81\u884c\u3067\u7d50\u679c\u3092\u8868\u793a\u3059\u308b<\/p>\n<pre class=\"post-pre\"><code>$ git log --oneline\r\nWARNING: terminal is not fully functional\r\ne2d910d (HEAD -&gt; master) Mofify a\r\n7ce4117 Merge\r\nd461a70 Modify a\r\n8c697e8 (origin\/master, origin\/HEAD) Add c \/ Remove b \/ Modify a\r\n911b9a6 Add b\r\n428dde2 Add a\r\n<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u5bf9\u5176\u4ed6\u9009\u9879\u4e5f\u611f\u5174\u8da3\u7684\u8bdd\uff0c\u53ef\u4ee5\u8c03\u67e5\u4e00\u4e0b\uff0c\u56e0\u4e3a\u5b83\u4f3c\u4e4e\u6709\u5f88\u591a\u9009\u62e9\u3002<\/p>\n<hr \/>\n<h3>\u6dfb\u52a0<\/h3>\n<p>\u628a\u5de5\u4f5c\u6811\u7684\u5185\u5bb9\u6dfb\u52a0\u5230\u7d22\u5f15\u4e2d\u7684\u547d\u4ee4\u3002<\/p>\n<p>\u8bf7\u6307\u5b9a\u6587\u4ef6<\/p>\n<pre class=\"post-pre\"><code>git add [\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9]\r\n<\/code><\/pre>\n<p>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6307\u5b9a\u591a\u4e2a\u6587\u4ef6<\/p>\n<pre class=\"post-pre\"><code>git add *.csv\r\n<\/code><\/pre>\n<p>\u5c06\u6240\u6709\u6709\u66f4\u6539\u6216\u5220\u9664\u7684\u6587\u4ef6\u90fd\u6dfb\u52a0\u5230add\u547d\u4ee4\u4e2d\uff08\u4e0d\u5305\u62ec\u65b0\u521b\u5efa\u7684\u6587\u4ef6\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>git add -u\r\n<\/code><\/pre>\n<p>\u5c06\u6240\u6709\u65b0\u521b\u5efa\u6216\u4fee\u6539\u7684\u6587\u4ef6\u5168\u90e8\u6dfb\u52a0\uff08\u5220\u9664\u7684\u6587\u4ef6\u4e0d\u4f1a\u88ab\u79fb\u9664\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>git add .\r\n<\/code><\/pre>\n<p>\u5c06\u65b0\u5efa\u3001\u4fee\u6539\u548c\u5220\u9664\u7684\u6240\u6709\u6587\u4ef6\u90fd\u6dfb\u52a0<\/p>\n<pre class=\"post-pre\"><code>git add -A\r\n<\/code><\/pre>\n<hr \/>\n<h3>\u5220\u9664<\/h3>\n<p>\u5220\u9664\u7279\u5b9a\u6587\u4ef6\u7684\u547d\u4ee4\u3002<br \/>\n\u7531\u4e8e\u5df2\u4ecegit\u7ba1\u7406\u4e2d\u5220\u9664\u7684\u5386\u53f2\u8bb0\u5f55\u4ecd\u4fdd\u5b58\u5728\u7d22\u5f15\u4e2d\uff0c\u56e0\u6b64\u53ef\u4ee5\u901a\u8fc7\u5c06\u5176\u63d0\u4ea4\u6765\u4ece\u8fdc\u7a0b\u5b58\u50a8\u5e93\u7ba1\u7406\u4e2d\u5220\u9664\u3002<\/p>\n<p>\u5728\u5de5\u4f5c\u533a\u4e2d\u5220\u9664\u6ca1\u6709\u66f4\u6539\u7684\u6587\u4ef6\u65f6\uff0c\u5df2\u7ecf\u6dfb\u52a0\u5230\u7d22\u5f15\u4e2d\u7684\u6587\u4ef6\u4f1a\u88ab\u5220\u9664\uff0c\u5e76\u88ab\u6dfb\u52a0\u4e3a\u5220\u9664\u72b6\u6001\u5230\u7d22\u5f15\uff0c\u5e76\u4ece\u5de5\u4f5c\u533a\u4e2d\u5220\u9664\u3002<\/p>\n<pre class=\"post-pre\"><code>git rm [\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9]\r\n<\/code><\/pre>\n<h5>\u9009\u62e9<\/h5>\n<p>-d<br \/>\n\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u6bce\u524a\u9664\u3059\u308b<\/p>\n<p>-f<br \/>\n\u5f37\u5236\u7684\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3059\u308b\u3002\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u306b\u3066\u5909\u66f4\u304c\u3042\u3063\u3066\u3082\u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044<\/p>\n<p>&#8211;cached<br \/>\n\u30ef\u30fc\u30ad\u30f3\u30b0\u30c4\u30ea\u30fc\u304b\u3089\u306f\u524a\u9664\u3057\u306a\u3044\uff08\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304b\u3089\u306e\u524a\u9664\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3078\u306e\u524a\u9664\u3068\u3057\u3066\u306e\u8ffd\u52a0\u306e\u307f\uff09<\/p>\n<hr \/>\n<h3>\u7535\u5f71<\/h3>\n<p>\u66f4\u6539\u6587\u4ef6\u540d\u79f0\u3001\u79fb\u52a8\u6587\u4ef6\u7684\u547d\u4ee4<\/p>\n<pre class=\"post-pre\"><code>git mv [\u5909\u66f4\u524d\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9] [\u5909\u66f4\u5f8c\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9]\r\n<\/code><\/pre>\n<p>\u6211\u4eec\u5185\u90e8\u6b63\u5728\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u8bef\u64cd\u4f5c\u4e86linux\u547d\u4ee4mv\uff0c\u4e5f\u53ef\u4ee5\u653e\u5fc3\uff0c\u4e0d\u4f1a\u6709\u95ee\u9898\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u79fb\u52a8 [\u539f\u6587\u4ef6\u8def\u5f84] [\u76ee\u6807\u6587\u4ef6\u8def\u5f84]<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>git \u6dfb\u52a0 [\u76ee\u6807\u6587\u4ef6\u8def\u5f84]<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>git \u5220\u9664 [\u539f\u6587\u4ef6\u8def\u5f84]<\/ol>\n<hr \/>\n<h3>\u5b8c\u6210<\/h3>\n<p>\u5c06\u7d22\u5f15\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u5408\u5e76\u5230\u672c\u5730\u5206\u652f\u7684\u547d\u4ee4\uff0c\u4f1a\u6253\u5f00\u7f16\u8f91\u5668\u4ee5\u8f93\u5165\u63d0\u4ea4\u6d88\u606f\u3002<\/p>\n<pre class=\"post-pre\"><code>git commit\r\n<\/code><\/pre>\n<h5>\u8fd9\u4e2a\u9009\u9879<\/h5>\n<p>-m [\u30e1\u30c3\u30bb\u30fc\u30b8] or &#8211;messsage [\u30e1\u30c3\u30bb\u30fc\u30b8]<br \/>\n\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u30a8\u30c7\u30a3\u30bf\u3092\u958b\u304b\u305a\u5165\u529b\u3059\u308b<\/p>\n<p>&#8211;amend<br \/>\n\u6700\u65b0\u306e\u30b3\u30df\u30c3\u30c8\u3092\u53d6\u308a\u6d88\u3057\u3066\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u5185\u5bb9\u3092\u30b3\u30df\u30c3\u30c8\u3092\u3084\u308a\u76f4\u3059<br \/>\n\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u5909\u66f4\u304c\u7121\u3044\u5834\u5408\u306f\u3001\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u307f\u3092\u66f8\u304d\u63db\u3048\u308b\u3053\u3068\u3082\u3067\u304d\u308b<br \/>\n-m\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3082\u53ef<\/p>\n<hr \/>\n<h3>\u91cd\u65b0\u8bbe\u7f6e<\/h3>\n<p>\u6267\u884c\u53d6\u6d88\u64cd\u4f5c\u7684\u547d\u4ee4<\/p>\n<pre class=\"post-pre\"><code>git reset [\u30e2\u30fc\u30c9] &lt;commit&gt;\r\n<\/code><\/pre>\n<p>[\u6a21\u5f0f] \u6307\u5b9a\u4e0b\u5217\u5185\u5bb9\uff0c\u82e5\u672a\u6307\u5b9a\u5219\u9ed8\u8ba4\u4e3a&#8211;\u6df7\u5408\u6a21\u5f0f<br \/>\n&#8211;\u8f6f\u8bbe\u7f6e\u4e3a HEAD \u4f4d\u7f6e<br \/>\n&#8211;\u6df7\u5408\u8bbe\u7f6e\u4e3a HEAD \u4f4d\u7f6e\u548c\u7d22\u5f15<br \/>\n&#8211;\u786c\u8bbe\u7f6e\u4e3a HEAD \u4f4d\u7f6e\u3001\u7d22\u5f15\u548c\u5de5\u4f5c\u6811<\/p>\n<p>\u6307\u5b9a\u8981\u56de\u6eaf\u5230\u54ea\u4e2a\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>HEAD\u7684\u4f4d\u7f6e\u4ee3\u8868\u4e86\u63d0\u4ea4<\/p>\n<p>\u4ec5\u53d6\u6d88\u63d0\u4ea4\uff08\u8fd4\u56de\u5230add\u4e4b\u524d\u7684\u72b6\u6001\uff09<\/p>\n<pre class=\"post-pre\"><code>git reset --soft HEAD^\r\n<\/code><\/pre>\n<p>\u64a4\u9500\u6dfb\u52a0\u7684\u5185\u5bb9\uff08\u8fd4\u56de\u5230\u5de5\u4f5c\u533a\u7684\u66f4\u6539\u70b9\uff09<\/p>\n<pre class=\"post-pre\"><code>git reset HEAD\r\n<\/code><\/pre>\n<p>\u53d6\u6d88\u63d0\u4ea4\u5e76\u64a4\u9500add\u7684\u72b6\u6001\uff08\u53ef\u4ee5\u6062\u590d\u5230\u5de5\u4f5c\u533a\u7684\u66f4\u6539\u70b9\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>git reset HEAD^\r\n<\/code><\/pre>\n<p>\u5220\u9664\u6240\u6709\u63d0\u4ea4\u540e\u7684\u66f4\u6539\u3002<\/p>\n<pre class=\"post-pre\"><code>git reset --hard HEAD\r\n<\/code><\/pre>\n<p>\u60f3\u8981\u5728\u4e4b\u524d\u7684\u72b6\u6001\u4e0b\u786e\u8ba4\u64cd\u4f5c\uff08\u4e3a\u9632\u6b62\u66f4\u6539\u7b49\u6d88\u5931\uff0c\u8bf7\u63d0\u524d\u8fdb\u884c\u63a8\u9001\u4ee5\u514d\u5fd8\u8bb0\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>git reset --hard &lt;commit&gt;\r\n<\/code><\/pre>\n<p>\u6211\u60f3\u8ba9\u8fdc\u7a0b\u4ed3\u5e93\u7684\u72b6\u6001\u5b8c\u5168\u4e0e\u5f53\u524d\u76f8\u540c\uff08\u80fd\u591f\u5411\u524d\u8fdb\u884c\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>git reset --hard origin\/master\r\n<\/code><\/pre>\n<hr \/>\n<h3>\u63a8 (tu\u012b)<\/h3>\n<p>\u5c06\u672c\u5730\u4ee3\u7801\u5e93\u7684\u63d0\u4ea4\u8bb0\u5f55\u53d1\u9001\u5230\u8fdc\u7a0b\u4ee3\u7801\u5e93\u7684\u547d\u4ee4\u3002\u5982\u679c\u8fdc\u7a0b\u4ee3\u7801\u5e93\u5df2\u7ecf\u5b58\u5728\u5176\u4ed6\u63d0\u4ea4\u8bb0\u5f55\uff0c\u5219\u4f1a\u4ea7\u751f\u9519\u8bef\uff08\u9700\u8981\u5148\u8fdb\u884c\u62c9\u53d6\u64cd\u4f5c\u5e76\u89e3\u51b3\u51b2\u7a81\u7b49\uff09\u3002<\/p>\n<p>\u5982\u679c\u8fdc\u7a0b\u548c\u672c\u5730\u5206\u652f\u7684\u540d\u79f0\u76f8\u540c\u7684\u8bdd<\/p>\n<pre class=\"post-pre\"><code>git push [\u30ea\u30dd\u30b8\u30c8\u30ea\u540d] [\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<p>\u5f53\u8fdc\u7a0b\u5206\u652f\u540d\u4e0e\u672c\u5730\u5206\u652f\u540d\u4e0d\u540c\u65f6<\/p>\n<pre class=\"post-pre\"><code>git push [\u30ea\u30dd\u30b8\u30c8\u30ea\u540d] [\u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u540d]:[\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<p>\u5982\u679c\u4e0d\u6307\u5b9a\u672c\u5730\u5206\u652f\uff0c\u5219\u53ef\u4ee5\u5220\u9664\u8fdc\u7a0b\u4ed3\u5e93\uff08\u5c31\u50cf\u53d1\u9001\u4e00\u4e2a\u7a7a\u7684\u56fe\u50cf\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>git push [\u30ea\u30dd\u30b8\u30c8\u30ea\u540d] :[\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<p>\u5220\u9664\u8fdc\u7a0b\u5206\u652f\uff08\u663e\u5f0f\u65b9\u5f0f\uff09<\/p>\n<pre class=\"post-pre\"><code>git push --delete [\u30ea\u30dd\u30b8\u30c8\u30ea\u540d] [\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<p>\u5982\u679c\u7701\u7565\u4ed3\u5e93\u540d\u79f0\u548c\u5206\u652f\u540d\u79f0\uff0c\u5219\u4f1a\u5c06\u5185\u5bb9\u53d1\u9001\u5230\u914d\u7f6e\u4e2d\u8bbe\u7f6e\u7684\u5f53\u524d\u672c\u5730\u5206\u652f\u7684\u4e0a\u6e38\u5206\u652f\u3002<br \/>\n\u5982\u679c\u4e0a\u8ff0\u5185\u5bb9\u4e0d\u5b58\u5728\uff0c\u5219\u91c7\u7528config.default\u4e2d\u7684\u5185\u5bb9\u3002\u5982\u679cconfig.default\u4e2d\u4e5f\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u9519\u3002<\/p>\n<h5>\u5728\u4e2d\u56fd\uff0c\u53ea\u9700\u8981\u4e00\u4e2a\u9009\u62e9\uff1a\u9009\u9879\u3002<\/h5>\n<p>-u<br \/>\n\u9001\u4fe1\u3057\u305f\u30ea\u30dd\u30b8\u30c8\u30ea\u540d\u3001\u30d6\u30e9\u30f3\u30c1\u540d\u3092\u4e0a\u6d41\u30d6\u30e9\u30f3\u30c1\u3068\u3057\u3066\u8a2d\u5b9a\u3059\u308b<\/p>\n<p>\u8bf7\u628a\u8fd9\u53e5\u8bdd\u7ffb\u8bd1\u6210\u4e2d\u6587\uff1a &#8220;I enjoy playing basketball with my friends at the park.&#8221;<\/p>\n<pre class=\"post-pre\"><code>git push origin master\r\n<\/code><\/pre>\n<hr \/>\n<h3>\u53d6\u8d70<\/h3>\n<p>\u5c06\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5185\u5bb9\u540c\u6b65\u5230\u8fdc\u7a0b\u8ddf\u8e2a\u5206\u652f\u7684\u547d\u4ee4\uff0c\u5982\u679c\u672c\u5730\u6ca1\u6709\u76f8\u5e94\u540d\u79f0\u7684\u5206\u652f\u5219\u4f1a\u521b\u5efa\u672c\u5730\u5206\u652f\u3002<\/p>\n<p>\u5c06\u6307\u5b9a\u540d\u79f0\u7684\u5206\u652f\u4ece\u8fdc\u7a0b\u540c\u6b65\u5230\u8fdc\u7a0b\u8ddf\u8e2a\u5206\u652f\u3002<\/p>\n<pre class=\"post-pre\"><code>git fetch [\u30ea\u30dd\u30b8\u30c8\u30ea\u540d] [\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<p>\u5c06\u6240\u6709\u8fdc\u7a0b\u5206\u652f\u540c\u6b65\u5230\u8fdc\u7a0b\u8ddf\u8e2a\u5206\u652f\u3002<\/p>\n<pre class=\"post-pre\"><code>git fetch [\u30ea\u30dd\u30b8\u30c8\u30ea\u540d]\r\n<\/code><\/pre>\n<p>\u4f7f\u7528\u300c\u306a\u3051\u308c\u3070\u4f5c\u6210\u3055\u308c\u308b\u300d\u3068\u3044\u3046\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3063\u3066\u3001\u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u3092\u5225\u540d\u3068\u3057\u3066\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"post-pre\"><code>git fetch [\u30ea\u30dd\u30b8\u30c8\u30ea\u540d] [\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u540d]:[\u30ed\u30fc\u30ab\u30eb\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<hr \/>\n<h3>\u5c55\u793a<\/h3>\n<p>\u663e\u793a\u7279\u5b9a\u7248\u672c\u7684\u65e5\u5fd7<\/p>\n<pre class=\"post-pre\"><code>git show &lt;commit&gt;\r\n<\/code><\/pre>\n<p>\u663e\u793a\u7279\u5b9a\u7248\u672c\u7684\u7279\u5b9a\u6587\u4ef6<\/p>\n<pre class=\"post-pre\"><code>git show &lt;commit&gt;:&lt;path&gt;\r\n<\/code><\/pre>\n<h3>\u5408\u5e76<\/h3>\n<p>\u5c06\u672c\u5730\u5b58\u50a8\u5e93\u7684\u5206\u652f\u5185\u5bb9\u5408\u5e76\u5230\u5f53\u524d\u5206\u652f\u3002<\/p>\n<pre class=\"post-pre\"><code>git merge [\u53d6\u308a\u8fbc\u307f\u305f\u3044\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<p>\u4e00\u79cd\u9009\u62e9\u662f\u5c06\u5206\u652f\u540d\u79f0\u6307\u5b9a\u4e3a\u8fdc\u7a0b\u8ddf\u8e2a\u5206\u652f\u3002<\/p>\n<p>\u8fdb\u884c\u5408\u5e76\u540e\u4f1a\u521b\u5efa\u4e00\u4e2a\u5408\u5e76\u63d0\u4ea4<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/185-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u5982\u679c\u5f53\u524d\u5206\u652f\u548c\u5408\u5e76\u5206\u652f\u90fd\u6709\u63d0\u4ea4\u7684\u66f4\u6539\uff0c\u5219\u81ea\u52a8\u8fdb\u884c\u5408\u5e76\u63d0\u4ea4\uff0c\u5e76\u6253\u5f00\u7f16\u8f91\u5668\u4ee5\u7f16\u8f91\u63d0\u4ea4\u4fe1\u606f\u3002<\/p>\n<p>\u5982\u679c\u5f53\u524d\u5206\u652f\u4e4b\u524d\u6ca1\u6709\u4efb\u4f55\u63d0\u4ea4\uff08\u5f53\u524d\u5206\u652f\u4e3a\u7a7a\uff09\uff0c\u5219\u4e0d\u9700\u8981\u8fdb\u884c\u5408\u5e76\u63d0\u4ea4\u3002<\/p>\n<p>\u5982\u679c\u66f4\u6539\u4e86\u76f8\u540c\u7684\u4f4d\u7f6e\u4f1a\u5bfc\u81f4\u51b2\u7a81\uff0c\u4ee5\u89e3\u51b3\u5e76\u6267\u884c\u5408\u5e76\u63d0\u4ea4\u3002<\/p>\n<h5>\u8bf7\u7528\u4e2d\u6587\u7ed9\u51fa\u4e0b\u9762\u7684\u9009\u9879\uff1a<\/h5>\n<p>\u9009\u9879<\/p>\n<p>-m [\u30e1\u30c3\u30bb\u30fc\u30b8]<br \/>\n\u30de\u30fc\u30b8\u30b3\u30df\u30c3\u30c8\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u30a8\u30c7\u30a3\u30bf\u30fc\u3092\u958b\u304b\u305a\u6307\u5b9a\u3059\u308b<\/p>\n<p>&#8211;no-ff<br \/>\nfast-forward\u306e\u969b\u3082\u30de\u30fc\u30b8\u30b3\u30df\u30c3\u30c8\u3092\u5fc5\u8981\u3068\u3059\u308b<\/p>\n<p>\u51b2\u7a81\u7684\u89e3\u51b3<\/p>\n<pre class=\"post-pre\"><code>$ git merge master2\r\nAuto-merging d.txt\r\nCONFLICT (add\/add): Merge conflict in d.txt\r\nAutomatic merge failed; fix conflicts and then commit the result.\r\n$ git status --short\r\nAA d.txt\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD\r\nddd\r\n=======\r\nd\r\n&gt;&gt;&gt;&gt;&gt;&gt;&gt; master2\r\n<\/code><\/pre>\n<hr \/>\n<h3>\u8c03\u57fa<\/h3>\n<p>rebase\u662f\u4e00\u6761\u547d\u4ee4\uff0c\u7528\u4e8e\u5c06\u53e6\u4e00\u4e2a\u5206\u652f\u7684\u63d0\u4ea4\u79fb\u52a8\u5230\u7279\u5b9a\u5206\u652f\u7684HEAD\u4e4b\u540e\u3002<\/p>\n<p>\u901a\u8fc7\u8fd9\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u65e5\u5fd7\u53d8\u5f97\u6574\u6d01\uff0c\u6210\u4e3a\u4e00\u6761\u76f4\u7ebf\u7684\u5386\u53f2\u8bb0\u5f55\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/198-0.png\" alt=\"image.png\" \/><\/div>\n<h5>\u8bf7\u9009\u62e9\u4e00\u79cd\u9009\u9879<\/h5>\n<p>-i<br \/>\nrebase\u3059\u308b\u30d6\u30e9\u30f3\u30c1\uff08\u56f3\u306eblue\u30d6\u30e9\u30f3\u30c1\uff09\u306b\u8907\u6570\u30b3\u30df\u30c3\u30c8\u304c\u3042\u308b\u969b\u306b\u3001\u307e\u3068\u3081\u30661\u3064\u306e\u30b3\u30df\u30c3\u30c8\u3068\u3057\u3066\u6301\u3063\u3066\u304f\u308b\u3053\u3068\u304c\u3067\u304d\u308b<br \/>\n\u30a8\u30c7\u30a3\u30bf\u304c\u958b\u304b\u308c\u3069\u306e\u30b3\u30df\u30c3\u30c8\u3092\u3069\u3046\u307e\u3068\u3081\u308b\u304b\u3092\u6307\u5b9a\u3059\u308b<br \/>\npick: \u305d\u306e\u307e\u307e\u3082\u3063\u3066\u304f\u308b<br \/>\nsquash: \u4e0a\u306e\u30b3\u30df\u30c3\u30c8\u306b\u307e\u3068\u3081\u308b\uff08\u62bc\u3057\u3064\u3076\u3059\uff09\u203b\u4e00\u756a\u4e0a\u306e\u30b3\u30df\u30c3\u30c8\u306fsquash\u306b\u3067\u304d\u306a\u3044<\/p>\n<pre class=\"post-pre\"><code>pick 8145f1c Fix screen rotation problem\r\npick d90db4a v1.2.4\r\npick 646bf79 Fix screen rotation problem\r\npick 71a6940 v1.2.4\r\n\r\n# Rebase ed7420a..71a6940 onto ed7420a\r\n#\r\n# Commands:\r\n#  p, pick = use commit\r\n#  r, reword = use commit, but edit the commit message\r\n#  e, edit = use commit, but stop for amending\r\n#  s, squash = use commit, but meld into previous commit\r\n#  f, fixup = like \"squash\", but discard this commit's log message\r\n#  x, exec = run command (the rest of the line) using shell\r\n#\r\n# These lines can be re-ordered; they are executed from top to bottom.\r\n#\r\n# If you remove a line here THAT COMMIT WILL BE LOST.\r\n# However, if you remove everything, the rebase will be aborted.\r\n#\r\n<\/code><\/pre>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/202-0.png\" alt=\"image.png\" \/><\/div>\n<p>Git rebase \u53ef\u4ee5\u5c06\u5f53\u524d\u5206\u652f\u7684\u591a\u4e2a\u63d0\u4ea4\u5408\u5e76\u5728\u4e00\u8d77\u3002\u7136\u800c\uff0c\u7531\u4e8e\u63d0\u4ea4\u7684 SHA-1 \u503c\u4f1a\u53d1\u751f\u66f4\u6539\uff0c\u5982\u679c\u8fd9\u4e9b\u63d0\u4ea4\u5df2\u7ecf\u5728\u8fdc\u7a0b\u5206\u652f\u4e0a\u88ab\u5e94\u7528\uff0c\u90a3\u4e48\u5728\u8fdb\u884c push \u64cd\u4f5c\u65f6\u4f1a\u51fa\u9519\uff0c\u9700\u8981\u4f7f\u7528 git push -f \u5f3a\u5236\u63a8\u9001\u3002\u7531\u4e8e git push -f \u4f1a\u88ab\u8ba4\u4e3a\u662f\u4e00\u79cd\u4e0d\u63a8\u8350\u7684\u64cd\u4f5c\uff0c\u6240\u4ee5\u6700\u597d\u4e0d\u8981\u9891\u7e41\u4f7f\u7528 rebase\u3002<\/p>\n<p>\u8fd8\u6709\u5176\u4ed6\u8fd0\u64cd\u4f5c\u4e0a\u7684\u53ef\u6015\u98ce\u9669\uff0c\u6240\u4ee5\u5e94\u8be5\u67e5\u770b\u4ee5\u4e0b\u5185\u5bb9<br \/>\n\u5b98\u65b9\u6587\u6863\uff1aGit\u7684\u5206\u652f\u529f\u80fd-\u53d8\u57fa \u771f\u6b63\u53ef\u6015\u7684\u53d8\u57fa<\/p>\n<hr \/>\n<h3>\u62c9 (l\u0101)<\/h3>\n<p>pull\u547d\u4ee4\u5728\u5185\u90e8\u6267\u884c\u4e86fetch\u548cmerge\u64cd\u4f5c\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u4ece&lt;\u4ed3\u5e93&gt;\u7684&lt;\u5206\u652f&gt;\u83b7\u53d6\uff08fetch\uff09\u4ee3\u7801<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u5408\u5e76\uff08merge\uff09FETCH_HEAD<\/ol>\n<p>\u5728\u8fd9\u4e2a\u65f6\u5019\uff0c\u4e3a\u4e86\u5408\u5e76\u6240\u83b7\u53d6\u7684\u5206\u652f\u540d\u79f0\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528FETCH_HEAD\u3002<\/p>\n<h5>\u9009\u9879<\/h5>\n<p>&#8211;no-ff<br \/>\nmerge\u3068\u540c\u69d8<\/p>\n<hr \/>\n<h3>\u5206\u652f zh\u012b)<\/h3>\n<p>\u521b\u5efa\u3001\u68c0\u67e5\u548c\u5220\u9664\u5206\u652f\u7684\u547d\u4ee4\u3002<\/p>\n<p>\u663e\u793a\u672c\u5730\u5206\u652f<\/p>\n<pre class=\"post-pre\"><code>git branch\r\n<\/code><\/pre>\n<p>\u663e\u793a\u8fdc\u7a0b\u5206\u652f<\/p>\n<pre class=\"post-pre\"><code>git branch -r\r\n<\/code><\/pre>\n<p>\u663e\u793a\u672c\u5730\u548c\u8fdc\u7a0b\u5206\u652f<\/p>\n<pre class=\"post-pre\"><code>git branch -a\r\n<\/code><\/pre>\n<p>\u4ece\u5f53\u524d\u5206\u652f\u4e2d\u521b\u5efa\u4e00\u4e2a\u672c\u5730\u5206\u652f\u3002<\/p>\n<pre class=\"post-pre\"><code>git branch [\u65b0\u3057\u3044\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<p>\u5982\u679c\u5206\u652f\u672a\u5408\u5e76\u5230HEAD\uff0c\u4ece\u672c\u5730\u5220\u9664\u5206\u652f\u4f1a\u51fa\u9519\u3002<\/p>\n<pre class=\"post-pre\"><code>git branch -d [\u524a\u9664\u3059\u308b\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<p>\u5220\u9664\u672c\u5730\u5206\u652f\uff08\u65e0\u8bba\u662f\u5426\u5408\u5e76\u5230HEAD\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>git branch -D [\u524a\u9664\u3059\u308b\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<p>\u5728\u5f53\u524d\u6240\u5728\u7684\u5206\u652f\u4e0a\u66f4\u6539\u5206\u652f\u540d\u79f0\u3002<\/p>\n<pre class=\"post-pre\"><code>git branch -m [\u65b0\u3057\u3044\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<p>\u5728\u4e0d\u5728\u8981\u66f4\u6539\u7684\u5206\u652f\u4e0a\u8fdb\u884c\u5206\u652f\u540d\u79f0\u66f4\u6539 (\u4e0d\u5728\u8981\u66f4\u6539\u7684\u5206\u652f\u4e0a)<\/p>\n<pre class=\"post-pre\"><code>git branch -m [\u53e4\u3044\u30d6\u30e9\u30f3\u30c1\u540d] [\u65b0\u3057\u3044\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<hr \/>\n<h3>\u7ed3\u8d26<\/h3>\n<p>\u6267\u884c\u4ee5\u4e0b\u4e24\u4e2a\u64cd\u4f5c\u7684\u547d\u4ee4<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u2460\u4f5c\u696d\u30d6\u30e9\u30f3\u30c1\u3092\u5207\u308a\u66ff\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\">\u2461\u6307\u5b9a\u3057\u305f\u30b3\u30df\u30c3\u30c8\uff08\u3082\u3057\u304f\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\uff09\u306e\u72b6\u614b\u3092\u3001\u73fe\u5728\u306e\u4f5c\u696d\u30c4\u30ea\u30fc\u306b\u5c55\u958b\u3059\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\">\u2462\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u6307\u5b9a\u3057\u305f\u30b3\u30df\u30c3\u30c8\u306e\u72b6\u614b\u306b\u5909\u66f4\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u2463\u30b9\u30bf\u30c3\u30b7\u30e5\u3055\u308c\u305f\u7279\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u3092\u4f5c\u696d\u30c4\u30ea\u30fc\u306b\u5c55\u958b\u3059\u308b<\/ul>\n<h5>\u5207\u6362\u5230\u4f5c\u4e1a\u5206\u652f\u3002<\/h5>\n<pre class=\"post-pre\"><code>git checkout [\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<p>\u5de5\u4f5c\u6811\u4e2d\u672a\u8ddf\u8e2a\u7684\u6587\u4ef6\uff08\u672a\u6dfb\u52a0\u7684\u65b0\u6587\u4ef6\uff09\u548c\u7d22\u5f15\u4e2d\u7684\u5185\u5bb9\uff08\u5df2\u6dfb\u52a0\u6216\u5220\u9664\u7684\u5185\u5bb9\uff09\u5c06\u88ab\u76f4\u63a5\u4f20\u9012\u5230\u6240\u66f4\u6539\u7684\u5206\u652f\u4e2d\u3002<\/p>\n<p>\u5f53\u5207\u6362\u5206\u652f\u65f6\uff0c\u6587\u4ef6\u4e5f\u4f1a\u88ab\u5168\u90e8\u6539\u53d8\u4e3a\u88ab\u5207\u6362\u7684\u5206\u652f\u7684\u72b6\u6001\u3002<br \/>\n=&gt; \u5982\u679c\u7ee7\u627f\u7684\u5de5\u4f5c\u533a\u548c\u7d22\u5f15\u5185\u5bb9\u53d1\u751f\u51b2\u7a81\uff0c\u5c06\u4f1a\u4ea7\u751f\u9519\u8bef\u5e76\u505c\u6b62\u5206\u652f\u5207\u6362\u3002<\/p>\n<h5>\u5c06\u7279\u5b9a\u7684\u63d0\u4ea4\uff08\u6216\u7d22\u5f15\uff09\u72b6\u6001\u5728\u5f53\u524d\u5de5\u4f5c\u6811\u4e2d\u5c55\u5f00\u3002<\/h5>\n<pre class=\"post-pre\"><code>git checkout &lt;commit&gt;\r\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u5207\u6362\u5230\u7279\u5b9a\u7684\u63d0\u4ea4\u72b6\u6001\uff0c\u4f46\u7531\u4e8e\u6307\u5b9a\u4e86\u63d0\u4ea4\uff0c\u4f1a\u5bfc\u81f4\u5934\u6307\u9488\u5206\u79bb\u3002<\/p>\n<h5>\u4ec5\u5c06\u7279\u5b9a\u6587\u4ef6\u66f4\u6539\u4e3a\u6307\u5b9a\u63d0\u4ea4\u7684\u72b6\u6001\u3002<\/h5>\n<pre class=\"post-pre\"><code>git checkout &lt;commit&gt; [\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9]\r\n<\/code><\/pre>\n<p>\u7531\u4e8eHEAD\u4e0d\u4f1a\u6539\u53d8\uff0c\u6240\u4ee5\u4e0d\u4f1a\u6210\u4e3adetached HEAD\u3002<br \/>\n\u6307\u5b9a\u7684\u6587\u4ef6\u5c06\u5728\u5de5\u4f5c\u533a\u548c\u7d22\u5f15\u4e2d\u53cd\u6620\u4e3a\u6307\u5b9a\u63d0\u4ea4\u7684\u72b6\u6001\u3002<\/p>\n<pre class=\"post-pre\"><code>git checkout .\r\n<\/code><\/pre>\n<p>\u5982\u679c\u8003\u8651\u5230\u672a\u8ffd\u8e2a\u7684\u6587\u4ef6\u7b49\u56e0\u7d20\uff0c\u5e76\u4e14\u7d22\u5f15\u4e3a\u7a7a\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u66f4\u597d\u5730\u4f7f\u7528git reset &#8211;hard HEAD\u6765\u5c06\u73b0\u6709\u6587\u4ef6\uff08\u9664\u4e86\u672a\u8ffd\u8e2a\u7684\u6587\u4ef6\u4ee5\u5916\uff09\u7684\u66f4\u6539\u6062\u590d\u56deHEAD\u7684\u72b6\u6001\u3002<\/p>\n<h5>\u53ea\u5c55\u5f00\u5b58\u50a8\u5728\u5de5\u4f5c\u76ee\u5f55\u4e2d\u7684\u7279\u5b9a\u6587\u4ef6\u3002<\/h5>\n<p>\u2193x\u7684\u90e8\u5206\u662fstash\u7684\u7f16\u53f7\u3002<\/p>\n<pre class=\"post-pre\"><code>git checkout stash@{x} [\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9]\r\n<\/code><\/pre>\n<p>\u203b\u5b58\u50a8\u7684\u5185\u5bb9\u4e0d\u4f1a\u6d88\u5931\u3002<\/p>\n<h5>\u9009\u9879<\/h5>\n<p>-b<br \/>\n\u30d6\u30e9\u30f3\u30c1\u306e\u4f5c\u6210\u3001\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u3092\u540c\u6642\u3067\u884c\u3046<\/p>\n<pre class=\"post-pre\"><code>git checkout -b [\u65b0\u3057\u3044\u30d6\u30e9\u30f3\u30c1\u540d]\r\n<\/code><\/pre>\n<h3>\u9690\u85cf<\/h3>\n<p>\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u6765\u66f4\u6539\u5de5\u4f5c\u7a7a\u95f4\u5e76\u5907\u4efd\u7d22\u5f15\u5185\u5bb9\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u672a\u8ddf\u8e2a\u7684\u6587\u4ef6\u4e0d\u4f1a\u88ab\u5907\u4efd\u3002<\/p>\n<h4>\u63a8<\/h4>\n<p>\u5c06\u8be5\u547d\u4ee4\u6dfb\u52a0\u5230stash\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code>git stash push\r\n<\/code><\/pre>\n<p>\u53ea\u6dfb\u52a0\u7279\u5b9a\u7684\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code>git stash push -- [\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9]\r\n<\/code><\/pre>\n<h5>\u9009\u9879<\/h5>\n<p>-p<br \/>\n\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u306b1\u30d5\u30a1\u30a4\u30eb\u305a\u3064\u5dee\u5206\u304c\u8868\u793a\u3055\u308cstash\u3055\u305b\u308b\u5bfe\u8c61\u306b\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u9078\u629e\u3059\u308b\u30e2\u30fc\u30c9<\/p>\n<p>-k<br \/>\n\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u5185\u5bb9\u306fstash\u3092\u3057\u306a\u3044<\/p>\n<p>-u<br \/>\nuntracking\u30d5\u30a1\u30a4\u30eb\u3082stash\u3059\u308b<\/p>\n<p>-m [\u30e1\u30c3\u30bb\u30fc\u30b8]<br \/>\nstash\u306b\u30bf\u30a4\u30c8\u30eb\uff1f\u8aac\u660e\uff1f\u3092\u4ed8\u3051\u308b<\/p>\n<h4>\u5217\u51fa<\/h4>\n<p>\u663e\u793a\u5728Stash\u4e2d\u6ce8\u518c\u7684\u5185\u5bb9\u7684\u547d\u4ee4<\/p>\n<pre class=\"post-pre\"><code>$ git stash list\r\nstash@{0}: On master: Add c\r\nstash@{1}: WIP on master: Modify a\r\n<\/code><\/pre>\n<h5>\u9009\u9879<\/h5>\n<p>\u53ef\u4ee5\u4f7f\u7528\u4e0egit log\u76f8\u540c\u7684\u9009\u9879<\/p>\n<h4>\u5c55\u793a<\/h4>\n<p>\u663e\u793a\u5b58\u50a8\u7684\u66f4\u6539\u7ec6\u8282\u7684\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>git stash show [stash\u540d]\r\n<\/code><\/pre>\n<p>\u5982\u679c\u7701\u7565[stash\u540d]\uff0c\u5c31\u4f1a\u4f7f\u7528\u6700\u65b0\u7684stash\uff0c\u4f8b\u5982stash@{0}\u3002<\/p>\n<h5>\u5728\u4e2d\u56fd\u4eba\u4f7f\u7528\u4e2d\u6587\uff0c\u53ea\u9700\u8981\u4e00\u79cd\u9009\u9879\uff1a<\/h5>\n<p>\u9009\u9879<\/p>\n<p>-p<br \/>\n\u5909\u66f4\u306e\u5185\u5bb9\u306e\u8a73\u7d30\u307e\u3067\u8868\u793a\u3059\u308b<\/p>\n<h4>\u7533\u8bf7<\/h4>\n<p>\u5c06\u5df2\u5728stash\u4e2d\u6ce8\u518c\u7684\u5185\u5bb9\u5e94\u7528\u5230\u5de5\u4f5c\u6811\u7684\u6307\u4ee4\u3002<br \/>\n\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u88ab\u767b\u8bb0\u5728\u7d22\u5f15\u4e2d\u7684\u5185\u5bb9\u4e5f\u5c06\u88ab\u8fd8\u539f\u4e3a\u672a\u6682\u5b58\uff08\u5373\u5de5\u4f5c\u6811\u4e2d\u7684\u4fee\u6539\u72b6\u6001\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>git stash apply [stash\u540d]\r\n<\/code><\/pre>\n<h5>\u5728\u4e2d\u6587\u4e2d\uff0c\u53ea\u9700\u8981\u4e00\u4e2a\u9009\u9879\uff0c\u6539\u5199\u5982\u4e0b\uff1a<\/h5>\n<p>\u9009\u9879<\/p>\n<p>&#8211;index<br \/>\n\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u5165\u3063\u305f\u72b6\u614b\u3067\u767b\u9332\u3055\u308c\u305f\u3082\u306e\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u53cd\u6620\u3055\u305b\u308b<\/p>\n<h4>\u653e\u4e0b<\/h4>\n<p>\u5220\u9664\u5728stash\u4e2d\u6ce8\u518c\u7684\u9879\u76ee\u7684\u547d\u4ee4<\/p>\n<pre class=\"post-pre\"><code>git stash apply [stash\u540d]\r\n<\/code><\/pre>\n<h4>\u6d41\u884c<\/h4>\n<p>\u7533\u8bf7\u548c\u53d6\u6d88\u5408\u5e76\u7684\u6307\u4ee4<\/p>\n<pre class=\"post-pre\"><code>git stash pop [stash\u540d]\r\n<\/code><\/pre>\n<h5>\u5728\u4e2d\u6587\u4e2d\uff0c\u8bf7\u91cd\u65b0\u89e3\u91ca\u4ee5\u4e0b\u5185\u5bb9\uff0c\u4ec5\u9700\u8981\u4e00\u4e2a\u9009\u9879\uff1a<\/h5>\n<p>\u9009\u9879<\/p>\n<p>&#8211;index<br \/>\n\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u5165\u3063\u305f\u72b6\u614b\u3067\u767b\u9332\u3055\u308c\u305f\u3082\u306e\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u53cd\u6620\u3055\u305b\u308b<\/p>\n<h4>\u660e\u786e<\/h4>\n<p>\u5220\u9664\u5b58\u50a8\u5e93\u4e2d\u6ce8\u518c\u7684\u6240\u6709\u5185\u5bb9\u7684\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>git stash clear\r\n<\/code><\/pre>\n<h4>\u5206\u652f<\/h4>\n<p>\u4ecestash\u7684\u63d0\u4ea4\u72b6\u6001\u4e2d\u521b\u5efa\u4e00\u4e2a\u5206\u652f\uff0c\u5c06stash\u4e2d\u7684\u5185\u5bb9\u53cd\u6620\u5230\u5de5\u4f5c\u76ee\u5f55\u548c\u7d22\u5f15\u4e2d\uff0c\u7136\u540e\u4ecestash\u4e2d\u5220\u9664\uff0c\u5e76\u5207\u6362\u5230\u65b0\u5206\u652f\u7684\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>git stash branch [\u65b0\u3057\u3044\u30d6\u30e9\u30f3\u30c1\u540d] [stash\u540d]\r\n<\/code><\/pre>\n<h2>\u8fdb\u884c\u672f\u8bed\u89e3\u91ca<\/h2>\n<h3>\u5934\u90e8\u662f<\/h3>\n<p>\u6307\u7684\u662f\u6700\u65b0\u7684\u63d0\u4ea4<\/p>\n<p>\u53ef\u4ee5\u4ece\u591a\u4e2a\u7236\u63d0\u4ea4\u4e2d\u9009\u62e9\u6307\u5b9a\u7684\u63d0\u4ea4\uff0c\u8be5\u63d0\u4ea4\u8ddd\u79bb\u5f53\u524d\u63d0\u4ea4\u4e4b\u524d\u7684\u67d0\u4e00\u4ee3\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u4ecegit\u76841.8.5\u7248\u672c\u5f00\u59cb\uff0c\u53ef\u4ee5\u4f7f\u7528@\u4f5c\u4e3aHEAD\u7684\u522b\u540d\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/298-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u5047\u8bbe\u5f53\u524d\u60c5\u51b5\u4e3aC<\/p>\n<p>HEAD =&gt; C<br \/>\n@ =&gt; C<br \/>\nHEAD~ =&gt; B<br \/>\nHEAD~2 =&gt; A<br \/>\nHEAD^ =&gt; B<br \/>\nHEAD^2 =&gt; B&#8217;<br \/>\n@^2 =&gt; B&#8217;<\/p>\n<p>\u5982\u679c\u5c06 &#8220;^&#8221; \u548c &#8220;~&#8221; \u8fde\u7eed\u4f7f\u7528\uff0c\u5c31\u50cf\u8ffd\u6eaf\u5230\u7956\u7236\u6bcd\u90a3\u6837\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/302-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u5982\u679c\u6211\u4eec\u5c06\u73b0\u72b6\u6807\u8bb0\u4e3aD\uff0c<br \/>\n\u5219HEAD^ =&gt; C<br \/>\nHEAD^2 =&gt; \u9519\u8bef\uff08\u6ca1\u6709\u4e24\u4e2a\uff09<br \/>\nHEAD^^ =&gt; B<br \/>\nHEAD^^2 =&gt; B&#8217;<br \/>\nHEAD~^2 =&gt; B&#8217;<\/p>\n<h3>SHA-1\u662f\u4ec0\u4e48\uff1f<\/h3>\n<p>\u6bcf\u4e2a git \u63d0\u4ea4\u7684\u4fee\u8ba2\u7248\u672c\u90fd\u6709\u4e00\u4e2a\u5173\u8054\u7684\u54c8\u5e0c\u503c\u3002<\/p>\n<p>\u5f53\u901a\u8fc7\u6267\u884cgit log\u7b49\u547d\u4ee4\u65f6\uff0c\u5728\u9ec4\u8272\u5b57\u7684commit\u53f3\u4fa7\u6240\u5199\u7684\u5185\u5bb9\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/307-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u5728\u6307\u5b9a\u7248\u672c\u65f6\u4e0d\u4ec5\u53ef\u4ee5\u4f7f\u7528HEAD^\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528SHA-1\u7684\u503c\u6765\u6307\u5b9a\u3002<\/p>\n<p>SHA-1\u53ea\u8981\u6709\u56db\u4e2a\u4ee5\u4e0a\u7684\u5b57\u7b26\uff0cgit\u5c31\u53ef\u4ee5\u5f88\u597d\u5730\u5224\u65ad\u51fa\u552f\u4e00\u7684\u5185\u5bb9\uff0c\u56e0\u6b64\u4e0d\u9700\u8981\u5199\u5165\u5168\u90e8\u5185\u5bb9\u3002<\/p>\n<h3>\u4e0a\u6e38\u5206\u652f\uff0c\u53c8\u79f0\u4e3a\u4e0a\u6d41\u5206\u652f\u3002<\/h3>\n<p>\u4f7f\u7528git remote\u7b49\u547d\u4ee4\u5c06\u672c\u5730\u5206\u652f\u4e0e\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5206\u652f\u76f8\u5173\u8054\u7684\u6982\u5ff5<\/p>\n<p>\u300c\u8fdc\u7a0b\u8ffd\u8e2a\u5206\u652f\u300d\u662f\u6307\u5c06\u7279\u5b9a\u8fdc\u7a0b\u5206\u652f\u7684\u72b6\u6001\u539f\u5c01\u4e0d\u52a8\u5730\u590d\u5236\u5230\u672c\u5730\u5206\u652f\u7684\u6982\u5ff5\u3002\u7531\u4e8e\u53ef\u80fd\u5b58\u5728\u4e0e\u4e0a\u6e38\u5206\u652f\u4e0d\u540c\u7684\u540d\u79f0\uff0c\u6240\u4ee5\u8bf7\u6ce8\u610f\u4e0d\u8981\u6df7\u6dc6\u3002<\/p>\n<h3>\u8fdc\u7a0b\u8ffd\u8e2a\u5206\u652f\u662f\u4ec0\u4e48\uff1f sh\u00ec ?)<\/h3>\n<p>\u4e3a\u4e86\u4fdd\u7559\u8fdc\u7a0b\u72b6\u6001\u800c\u521b\u5efa\u7684\u5206\u652f\uff1b<br \/>\n\u8be5\u5206\u652f\u4ec5\u53ef\u7528\u4e8e\u67e5\u770b\uff0c\u5fc5\u987b\u521b\u5efa\u3002<\/p>\n<p>\u5c06[\u30ea\u30dd\u30b8\u30c8\u30ea\u540d]\/[\u30ea\u30e2\u30fc\u30c8\u30d6\u30e9\u30f3\u30c1\u540d]\u4f5c\u4e3a\u5206\u652f\u540d\u79f0<\/p>\n<p>\u7531\u4e8e\u6709\u8fd9\u4e2a\u5206\u652f\uff0c\u73b0\u5728\u53ef\u4ee5\u5728\u4e0d\u8fdb\u884c\u8fdc\u7a0b\u8fde\u63a5\u7684\u60c5\u51b5\u4e0b\u67e5\u770b\u5dee\u5f02\/\u65e5\u5fd7\u7b49\u4fe1\u606f\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528git branch -a\u547d\u4ee4\u6765\u67e5\u770b\u8fdc\u7a0b\u8ddf\u8e2a\u5206\u652f\u3002<\/p>\n<h3>&#8220;\u5206\u79bb HEAD&#8221; \u7684\u610f\u601d\u662f\u4ec0\u4e48\uff1f<\/h3>\n<p>\u5207\u6362\u5230\u63d0\u4ea4(commit)\u800c\u4e0d\u662f\u901a\u8fc7 git checkout \u5207\u6362\u5230\u5206\u652f\u65f6\uff0c\u4f1a\u5bfc\u81f4\u6211\u7684\u5206\u652f\u6210\u4e3a detached HEAD\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/320-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u672c\u6765\uff0cHEAD\u662f\u6307\u5411\u5206\u652f\u7684\uff0c\u4f46\u7531\u4e8eHEAD\u6307\u5411\u63d0\u4ea4\uff0c\u6240\u4ee5\u6210\u4e3a\u6e38\u79bb\uff08\u5207\u65ad\uff09\u7684HEAD\u3002<br \/>\n\u5373\u4f7f\u6307\u5b9a\u4e86\u539f\u6765HEAD\u4f4d\u7f6e\u7684\u63d0\u4ea4\uff0c\u4e5f\u4f1a\u6210\u4e3a\u6e38\u79bbHEAD\u3002<\/p>\n<p>\u5982\u679c\u60f3\u8981\u89e3\u51b3\u5206\u79bb\u7684HEAD\u95ee\u9898\uff0c\u53ea\u9700\u6267\u884cgit checkout [\u5206\u652f\u540d\u79f0]\u5373\u53ef\u89e3\u51b3\u3002<\/p>\n<p>\u5373\u4f7f\u5904\u4e8e\u5206\u79bb\u5934\u72b6\u6001\uff0c\u4e5f\u53ef\u4ee5\u8fdb\u884c\u63d0\u4ea4\uff0c\u4f46\u7531\u4e8e\u4e0d\u5b58\u5728\u5206\u652f\uff0c\u5c06\u4f1a\u521b\u5efa\u4e00\u4e2a\u60ac\u7a7a\u7684\u63d0\u4ea4\u3002<br \/>\n\u5982\u679c\u5728\u6709\u63d0\u4ea4\u7684\u60c5\u51b5\u4e0b\u6267\u884c git checkout [\u5206\u652f\u540d]\uff0c\u5219\u4f1a\u663e\u793a\u4ee5\u4e0b\u8b66\u544a\u3002<\/p>\n<pre class=\"post-pre\"><code>Warning: you are leaving 2 commits behind, not connected to\r\nany of your branches:\r\n\r\n  &lt;commid-id-1&gt; &lt;commit-message-1&gt;\r\n  &lt;commit-id-2&gt; &lt;commit-message-2&gt;\r\n\r\nIf you want to keep them by creating a new branch, this may be a good time\r\nto do so with:\r\n\r\n git branch &lt;new-branch-name&gt; &lt;commit-id-1&gt;\r\n\r\nSwitched to branch 'master'\r\n<\/code><\/pre>\n<p>\u6309\u7167\u8fd9\u4e2a\u65b9\u6cd5\uff0c\u901a\u8fc7\u4f7f\u7528SHA-1\u6307\u5b9a\u7684\u7a7a\u4e2d\u60ac\u6d6e\u63d0\u4ea4\u6765\u521b\u5efa\u5206\u652f\uff0c<br \/>\n\u7136\u540e\u53ef\u4ee5\u8fde\u63a5\u5230\u539f\u5148\u7684\u5206\u652f\u8fdb\u884c\u5408\u5e76\u7b49\u64cd\u4f5c\u3002<\/p>\n<h3>\u201c\u30d7\u30eb\u30ea\u30af\u30a8\u30b9\u30c8\u201d \u662f\u4ec0\u4e48\u610f\u601d\uff1f<\/h3>\n<p>\u8bf7\u67e5\u770b\u63d0\u4ea4\u540e\u5728git\u6258\u7ba1\u670d\u52a1\uff08\u5982GitHub\u7b49\uff09\u4e0a\u7684\u901a\u77e5\u529f\u80fd\u3002<\/p>\n<p>\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u8003\u6b64\u5904\u3002<br \/>\nPull request\u662f\u4ec0\u4e48\uff1f<\/p>\n<h2>\u603b\u7ed3\u7ed3\u675f<\/h2>\n<p>\u4e00\u5f00\u59cb\u53ea\u662f\u5f00\u59cb\u5199\uff0c\u7ed3\u679c\u5374\u6210\u4e86\u4e00\u90e8\u5927\u4f5c&#8230; \u5f00\u59cb\u7684\u65f6\u5019\u53ea\u80fd\u6a21\u7cca\u5730\u7406\u89e3\uff0c\u6240\u4ee5\u6297\u62d2\u5fc3\u7406\u975e\u5e38\u5f3a\u70c8\uff0c\u4f46\u662f\u4e00\u65e6\u7406\u89e3\u4e86\u610f\u601d\uff0c\u53d1\u73b0\u771f\u7684\u5f88\u6709\u8da3\uff0c\u4e5f\u80fd\u591f\u5e26\u6765\u5f88\u591a\u5b66\u4e60\u7684\u4e50\u8da3\uff01<\/p>\n<p>\u8f93\u51fa\u771f\u7684\u5f88\u91cd\u8981\u3002\u56e0\u4e3a\u52aa\u529b\u7406\u89e3\u5b83\u5bf9\u6211\u6765\u8bf4\u4e5f\u662f\u4e2a\u597d\u5904\u3002<\/p>\n<p>\u5982\u679c\u80fd\u5bf9\u9700\u8981\u4ecesvn\u8fc1\u79fb\u5230git\u7684\u4eba\u63d0\u4f9b\u5e2e\u52a9\uff0c\u6211\u4f1a\u5f88\u9ad8\u5174\u3002<\/p>\n<h2>\u8bf7\u53c2\u89c1\u53c2\u8003\u8d44\u6599\u3002<\/h2>\n<p>\u975e\u5e38\u611f\u8c22\u60a8\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u57fa\u790e\u306b\u3064\u3044\u3066<\/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\u306e\u69cb\u9020](http:\/\/www.yasunaga&#8211; lab.bio.kyutech.ac.jp\/EosJ\/index.php\/GIT%E3%81%AE%E4%BD%BF%E3%81%84%E6%96%B9)<\/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\u306b\u3064\u3044\u3066<\/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\">origin\u306b\u3064\u3044\u3066<\/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\">reset\u306b\u3064\u3044\u3066<\/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\">pull, fetch + merge\u306b\u3064\u3044\u3066<\/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\">\u3044\u308d\u3044\u308d\u30b3\u30de\u30f3\u30c9\u307e\u3068\u3081<\/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\">remote\u306b\u3064\u3044\u3066<\/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\">diff\u306b\u3064\u3044\u3066<\/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\">log\u306b\u3064\u3044\u3066<\/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\">\u4e0a\u6d41\u30d6\u30e9\u30f3\u30c1\u306b\u3064\u3044\u3066<\/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\">push\u306b\u3064\u3044\u3066<\/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\">checkout\u306b\u3064\u3044\u3066<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">mv\u306b\u3064\u3044\u3066<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148 \u4ee5\u524d\u53ea\u662f\u7b80\u5355\u5730\u4f7f\u7528\u4e86\u4e00\u4e9b\u547d\u4ee4\uff0c\u6bd4\u5982add\u3001commit\u3001push\u548cpull\uff0c\u5bf9\u4e8e\u5b83\u4eec\u7684\u7406\u89e3\u8fd8\u5f88\u6d45\u663e\u3002\u4f46\u7531 [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-37781","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>git\u7406\u89e3\u7b14\u8bb0 - 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\/git\u7406\u89e3\u7b14\u8bb0\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"git\u7406\u89e3\u7b14\u8bb0\" \/>\n<meta property=\"og:description\" content=\"\u9996\u5148 \u4ee5\u524d\u53ea\u662f\u7b80\u5355\u5730\u4f7f\u7528\u4e86\u4e00\u4e9b\u547d\u4ee4\uff0c\u6bd4\u5982add\u3001commit\u3001push\u548cpull\uff0c\u5bf9\u4e8e\u5b83\u4eec\u7684\u7406\u89e3\u8fd8\u5f88\u6d45\u663e\u3002\u4f46\u7531 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/git\u7406\u89e3\u7b14\u8bb0\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-01T00:20:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-30T12:34:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/9-0.png\" \/>\n<meta name=\"author\" content=\"\u79d1, \u96c5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u96c5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \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\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/\",\"name\":\"git\u7406\u89e3\u7b14\u8bb0 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-05-01T00:20:13+00:00\",\"dateModified\":\"2024-04-30T12:34:12+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"git\u7406\u89e3\u7b14\u8bb0\"}]},{\"@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\/41e222757cdd2a3365361328bd79970a\",\"name\":\"\u79d1, \u96c5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u96c5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"git\u7406\u89e3\u7b14\u8bb0 - 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\/git\u7406\u89e3\u7b14\u8bb0\/","og_locale":"zh_CN","og_type":"article","og_title":"git\u7406\u89e3\u7b14\u8bb0","og_description":"\u9996\u5148 \u4ee5\u524d\u53ea\u662f\u7b80\u5355\u5730\u4f7f\u7528\u4e86\u4e00\u4e9b\u547d\u4ee4\uff0c\u6bd4\u5982add\u3001commit\u3001push\u548cpull\uff0c\u5bf9\u4e8e\u5b83\u4eec\u7684\u7406\u89e3\u8fd8\u5f88\u6d45\u663e\u3002\u4f46\u7531 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/git\u7406\u89e3\u7b14\u8bb0\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-05-01T00:20:13+00:00","article_modified_time":"2024-04-30T12:34:12+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d305737434c4406c5b7c5\/9-0.png"}],"author":"\u79d1, \u96c5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u96c5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/","name":"git\u7406\u89e3\u7b14\u8bb0 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-05-01T00:20:13+00:00","dateModified":"2024-04-30T12:34:12+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"git\u7406\u89e3\u7b14\u8bb0"}]},{"@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\/41e222757cdd2a3365361328bd79970a","name":"\u79d1, \u96c5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","caption":"\u79d1, \u96c5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/git%e7%90%86%e8%a7%a3%e7%ac%94%e8%ae%b0\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37781","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\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=37781"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37781\/revisions"}],"predecessor-version":[{"id":94150,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37781\/revisions\/94150"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=37781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=37781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=37781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}