{"id":116345,"date":"2026-10-21T07:25:27","date_gmt":"2026-10-20T23:25:27","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/116345.html"},"modified":"2026-10-21T07:25:27","modified_gmt":"2026-10-20T23:25:27","slug":"git-%e5%9f%ba%e7%a1%80%e6%93%8d%e4%bd%9c%e4%b8%8e%e5%af%b9%e8%b1%a1%e8%a7%82%e5%af%9f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/116345.html","title":{"rendered":"Git \u57fa\u7840\u64cd\u4f5c\u4e0e\u5bf9\u8c61\u89c2\u5bdf"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"1.%20%E5%88%9B%E5%BB%BA%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:40px\">1. \u521b\u5efa\u6587\u4ef6<\/p>\n<p id=\"2.%20%E5%B0%86%20file1%20%E6%B7%BB%E5%8A%A0%E5%88%B0%E6%9A%82%E5%AD%98%E5%8C%BA-toc\" style=\"margin-left:40px\">2. \u5c06 file1 \u6dfb\u52a0\u5230\u6682\u5b58\u533a<\/p>\n<p id=\"3.%20%E6%9F%A5%E7%9C%8B%20Git%20%E7%8A%B6%E6%80%81-toc\" style=\"margin-left:40px\">3. \u67e5\u770b Git \u72b6\u6001<\/p>\n<p id=\"4.%20%E6%8F%90%E4%BA%A4%20file1-toc\" style=\"margin-left:40px\">4. \u63d0\u4ea4 file1<\/p>\n<p id=\"5.%20%E5%86%8D%E6%AC%A1%E6%9F%A5%E7%9C%8B%E7%8A%B6%E6%80%81-toc\" style=\"margin-left:40px\">5. \u518d\u6b21\u67e5\u770b\u72b6\u6001<\/p>\n<p id=\"6.%20%E6%9F%A5%E7%9C%8B%E6%8F%90%E4%BA%A4%E6%97%A5%E5%BF%97-toc\" style=\"margin-left:40px\">6. \u67e5\u770b\u63d0\u4ea4\u65e5\u5fd7<\/p>\n<p id=\"7.%20%E6%8F%90%E4%BA%A4%20file2%20%E5%92%8C%20file3-toc\" style=\"margin-left:40px\">7. \u63d0\u4ea4 file2 \u548c file3<\/p>\n<p id=\"8.%20%E4%B8%80%E8%A1%8C%E6%98%BE%E7%A4%BA%20Git%20%E6%97%A5%E5%BF%97-toc\" style=\"margin-left:40px\">8. \u4e00\u884c\u663e\u793a Git \u65e5\u5fd7<\/p>\n<p id=\"9.%20%E8%A7%82%E5%AF%9F%20.git%20%E7%9B%AE%E5%BD%95%E5%8F%98%E5%8C%96-toc\" style=\"margin-left:40px\">9. \u89c2\u5bdf .git \u76ee\u5f55\u53d8\u5316<\/p>\n<p id=\"10.%20%E6%9F%A5%E7%9C%8B%20Git%20%E5%AF%B9%E8%B1%A1-toc\" style=\"margin-left:40px\">10. \u67e5\u770b Git \u5bf9\u8c61<\/p>\n<p id=\"11.%20%E9%AA%8C%E8%AF%81%20commit%20%E5%8F%AA%E6%8F%90%E4%BA%A4%E6%9A%82%E5%AD%98%E5%8C%BA%E5%86%85%E5%AE%B9-toc\" style=\"margin-left:40px\">11. \u9a8c\u8bc1 commit \u53ea\u63d0\u4ea4\u6682\u5b58\u533a\u5185\u5bb9<\/p>\n<p id=\"12.%20Git%20%E7%AE%A1%E7%90%86%E7%9A%84%E6%98%AF%E5%86%85%E5%AE%B9%E5%8F%98%E5%8C%96-toc\" style=\"margin-left:40px\">12. Git \u7ba1\u7406\u7684\u662f\u5185\u5bb9\u53d8\u5316<\/p>\n<p id=\"13.%20%E4%BF%AE%E6%94%B9%20ReadME%20%E5%B9%B6%E6%9F%A5%E7%9C%8B%20diff-toc\" style=\"margin-left:40px\">13. \u4fee\u6539 ReadME \u5e76\u67e5\u770b diff<\/p>\n<p id=\"14.%20%E6%8F%90%E4%BA%A4%20ReadME%20%E4%BF%AE%E6%94%B9-toc\" style=\"margin-left:40px\">14. \u63d0\u4ea4 ReadME \u4fee\u6539<\/p>\n<hr id=\"hr-toc\" \/>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"512\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232521-6ad7f8615fd0e.png\" width=\"1664\" \/><\/p>\n<p>\u672c\u6587\u8bb0\u5f55 Git \u4e2d add\u3001commit\u3001status\u3001log\u3001diff \u4ee5\u53ca .git \u5bf9\u8c61\u5e93\u7684\u57fa\u672c\u89c2\u5bdf\u3002 \u6838\u5fc3\u7ed3\u8bba&#xff1a;git add \u628a\u5de5\u4f5c\u533a\u6539\u52a8\u653e\u5165\u6682\u5b58\u533a&#xff0c;git commit \u628a\u6682\u5b58\u533a\u5185\u5bb9\u63d0\u4ea4\u5230\u672c\u5730\u4ed3\u5e93\u3002<\/p>\n<h3 id=\"1.%20%E5%88%9B%E5%BB%BA%E6%96%87%E4%BB%B6\">1. \u521b\u5efa\u6587\u4ef6<\/h3>\n<p>\u4f7f\u7528 touch \u521b\u5efa\u4e09\u4e2a\u6587\u4ef6<\/p>\n<p>touch file1 file2 file3 <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"132\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232522-6ad7f86293370.png\" width=\"708\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"117\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232522-6ad7f862a25ff.png\" width=\"783\" \/>\u6b64\u65f6\u76ee\u5f55\u4e2d\u4e00\u5171\u6709\u4e09\u4e2a\u6587\u4ef6&#xff1a;<\/p>\n<ul>\n<li>file1<\/li>\n<li>file2<\/li>\n<li>file3<\/li>\n<\/ul>\n<h3 id=\"2.%20%E5%B0%86%20file1%20%E6%B7%BB%E5%8A%A0%E5%88%B0%E6%9A%82%E5%AD%98%E5%8C%BA\">2. \u5c06 file1 \u6dfb\u52a0\u5230\u6682\u5b58\u533a<\/h3>\n<p>git add file1 <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"53\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232522-6ad7f862b5d55.png\" width=\"723\" \/><\/p>\n<p>git add file1 \u8fd9\u6761\u547d\u4ee4\u628a file1 \u653e\u5165\u6682\u5b58\u533a\u4e2d\u3002<\/p>\n<h3 id=\"3.%20%E6%9F%A5%E7%9C%8B%20Git%20%E7%8A%B6%E6%80%81\">3. \u67e5\u770b Git \u72b6\u6001<\/h3>\n<p>git status <\/p>\n<p>file1 \u5df2\u7ecf\u8fdb\u5165\u6682\u5b58\u533a&#xff0c;\u7b49\u5f85 commit \u63d0\u4ea4\u3002\u5e76\u4e14\u53d1\u73b0\u4e86 ReadME \u6587\u4ef6\u88ab\u4fee\u6539\u4f46\u662f\u6ca1\u6709\u63d0\u4ea4\u4fee\u6539\u540e\u7684\u6587\u4ef6&#xff0c;\u8fd8\u53d1\u73b0\u4e86 file2 \u548c file3 \u4e24\u4e2a\u6587\u4ef6\u6ca1\u6709\u8ffd\u8e2a\u3002\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"407\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232522-6ad7f862c335b.png\" width=\"1018\" \/><\/p>\n<h3 id=\"4.%20%E6%8F%90%E4%BA%A4%20file1\">4. \u63d0\u4ea4 file1<\/h3>\n<p>git commit -m &#034;file1&#034; <\/p>\n<p>\u4f7f\u7528 git commit -m &#034;file1&#034; \u628a\u6682\u5b58\u533a\u4e2d\u7684\u00a0file1 \u63d0\u4ea4\u5230\u672c\u5730\u4ed3\u5e93\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"108\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232522-6ad7f862e59f5.png\" width=\"900\" \/><\/p>\n<h3 id=\"5.%20%E5%86%8D%E6%AC%A1%E6%9F%A5%E7%9C%8B%E7%8A%B6%E6%80%81\">5. \u518d\u6b21\u67e5\u770b\u72b6\u6001<\/h3>\n<p>git status <\/p>\n<p>\u4f7f\u7528 git status \u67e5\u770b\u5f53\u524d git \u72b6\u6001&#xff0c;\u53d1\u73b0\u6682\u5b58\u533a\u4e2d\u7684 file1 \u5df2\u7ecf\u4e0d\u5728&#xff0c;\u53ea\u5269\u4e0b ReadME \u7684\u4fee\u6539\u6587\u4ef6\u672a\u63d0\u4ea4&#xff0c;file2 \u548c file3 \u672a\u8ffd\u8e2a\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"283\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232523-6ad7f86304318.png\" width=\"930\" \/><\/p>\n<h3 id=\"6.%20%E6%9F%A5%E7%9C%8B%E6%8F%90%E4%BA%A4%E6%97%A5%E5%BF%97\">6. \u67e5\u770b\u63d0\u4ea4\u65e5\u5fd7<\/h3>\n<p>git log <\/p>\n<p>\u4f7f\u7528 git log \u67e5\u770b\u6240\u6709\u7684 git \u65e5\u5fd7<\/p>\n<p>\u53d1\u73b0\u5df2\u7ecf\u6709\u4e86 add file1 \u7684\u65e5\u5fd7<\/p>\n<p>\u8fd9\u91cc\u7684\u00a0132ca0eafba09c8e5202b734693a65f1a91e3620 \u662f\u7ecf\u8fc7 hash \u8ba1\u7b97\u8fc7\u540e\u7684\u7248\u672c\u53f7&#xff0c;\u540e\u9762\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u8fd9\u91cc\u7684\u7248\u672c\u53f7\u6765\u8fdb\u884c\u56de\u9000\u5230\u8be5\u7248\u672c\u3002<\/p>\n<p>\u8fd8\u6709Author&#xff1a;\u8fd9\u4e00\u884c\u91cc\u9762\u5c31\u662f\u6211\u4eec\u914d\u7f6e\u7684 \u7528\u6237\u540d \u548c \u90ae\u7bb1 \u8d77\u4f5c\u7528\u4e86&#xff0c;\u5c31\u80fd\u770b\u5230\u662f\u8c01\u6765\u8fdb\u884c\u7684\u63d0\u4ea4\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"303\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232523-6ad7f863347c4.png\" width=\"970\" \/><\/p>\n<p>\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>\n<p>132ca0eafba09c8e5202b734693a65f1a91e3620 \u662f\u7ecf\u8fc7\u54c8\u5e0c\u8ba1\u7b97\u5f97\u5230\u7684\u7248\u672c\u53f7&#xff0c;\u4e5f\u53ef\u4ee5\u7406\u89e3\u4e3a\u63d0\u4ea4\u5bf9\u8c61\u7684 ID\u3002<\/p>\n<\/li>\n<li>\n<p>\u540e\u7eed\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u7248\u672c\u53f7\u56de\u9000\u5230\u8be5\u7248\u672c\u3002<\/p>\n<\/li>\n<li>\n<p>Author \u4e00\u884c\u663e\u793a\u7684\u662f\u914d\u7f6e\u7684\u7528\u6237\u540d\u548c\u90ae\u7bb1&#xff0c;\u7528\u4e8e\u6807\u8bc6\u662f\u8c01\u8fdb\u884c\u4e86\u63d0\u4ea4\u3002<\/p>\n<\/li>\n<\/ul>\n<h3 id=\"7.%20%E6%8F%90%E4%BA%A4%20file2%20%E5%92%8C%20file3\">7. \u63d0\u4ea4 file2 \u548c file3<\/h3>\n<p>git add file2 file3 <\/p>\n<p>\u4f7f\u7528\u00a0git add file2 file3 \u63d0\u4ea4\u4e24\u4e2a\u6587\u4ef6<\/p>\n<p>\u53d1\u73b0 file2 \u548c file3 \u90fd\u8fdb\u5165\u4e86\u6682\u5b58\u533a\u4e2d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"291\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232523-6ad7f8637da6a.png\" width=\"954\" \/><\/p>\n<p>\u4f7f\u7528\u00a0git commit -m &#034;add file2 file3&#034; \u628a file2 \u548c file3 \u63d0\u4ea4\u5230\u5de5\u4f5c\u533a<\/p>\n<p>git commit -m &#034;add file2 file3&#034; <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"188\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232524-6ad7f86429f3e.png\" width=\"1021\" \/><\/p>\n<p>\u518d\u6b21\u67e5\u770b\u65e5\u5fd7&#xff1a;\u4f7f\u7528 git log \u67e5\u770b\u672c\u6b21\u8bb0\u5f55\u5728git \u65e5\u5fd7\u4e2d\u88ab\u8bb0\u5f55<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"460\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232524-6ad7f864becf7.png\" width=\"999\" \/><\/p>\n<h3 id=\"8.%20%E4%B8%80%E8%A1%8C%E6%98%BE%E7%A4%BA%20Git%20%E6%97%A5%E5%BF%97\">8. \u4e00\u884c\u663e\u793a Git \u65e5\u5fd7<\/h3>\n<p>git log &#8211;pretty&#061;oneline <\/p>\n<p>git log &#8211;pretty&#061;oneline \u53ef\u4ee5\u628a Git \u65e5\u5fd7\u4ee5\u4e00\u884c\u4e00\u6761\u7684\u5f62\u5f0f\u6253\u5370\u51fa\u6765\u3002<\/p>\n<p>\u5176\u4e2d HEAD -&gt; master \u6307\u5411\u7684\u5c31\u662f\u6211\u4eec\u6700\u8fd1\u7684\u4e00\u6b21\u63d0\u4ea4\u3002<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"109\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232525-6ad7f865538ea.png\" width=\"917\" \/><\/p>\n<h3 id=\"9.%20%E8%A7%82%E5%AF%9F%20.git%20%E7%9B%AE%E5%BD%95%E5%8F%98%E5%8C%96\">9. \u89c2\u5bdf .git \u76ee\u5f55\u53d8\u5316<\/h3>\n<p>\u7ecf\u8fc7add \u548c commit \u4e4b\u540e .git \u6587\u4ef6\u53d1\u751f\u4e86\u54ea\u4e9b\u53d8\u5316<\/p>\n<p>\u4f7f\u7528 tree .git \u67e5\u770b\u7ed3\u6784<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1137\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232525-6ad7f8656f6f2.png\" width=\"981\" \/><\/p>\n<p>\u4f7f\u7528 cat .git\/HEAD \u67e5\u770bHEAD \u91cc\u6307\u5411\u7684\u662f\u6211\u4eec\u7684master\u5206\u652f<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"57\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232525-6ad7f865e1607.png\" width=\"745\" \/><\/p>\n<p>\u4f7f\u7528\u00a0cat .git\/refs\/heads\/master \u67e5\u770b master \u5206\u652f\u5f15\u7528\u548c\u6211\u4eec\u7684\u5f53\u524d git log \u67e5\u770b\u5230\u7684\u7248\u672c\u53f7\u4e00\u81f4<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"88\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232525-6ad7f865ee9ee.png\" width=\"996\" \/><\/p>\n<p>4b1a3958c0889c77218bbe85240b26bf51b95a0d \u8fd9\u91cc\u9762\u7684 4b \u5c31\u662f tree .git \u91cc\u9762\u7684objects \u76844b\u6587\u4ef6\u5939&#xff0c;1a3958c0889c77218bbe85240b26bf51b95a0d \u5c31\u662f\u6587\u4ef6\u540d<\/p>\n<h3 id=\"10.%20%E6%9F%A5%E7%9C%8B%20Git%20%E5%AF%B9%E8%B1%A1\">10. \u67e5\u770b Git \u5bf9\u8c61<\/h3>\n<p>\u4f7f\u7528 git cat-file -p\u00a04b1a3958c0889c77218bbe85240b26bf51b95a0d \u67e5\u770b\u6700\u65b0\u7248\u672c\u7684\u5bf9\u8c61&#xff0c;\u53d1\u73b0\u4e0a\u4e00\u6b21\u63d0\u4ea4\u7684 commit id \u548c \u63d0\u4ea4\u7684\u4eba\u662f\u8c01&#xff0c;\u63cf\u8ff0\u5c31\u662f\u6211\u4eec\u4f7f\u7528 git commit -m &#034;XXX&#034; \u4e2d\u8f93\u5165\u7684\u63cf\u8ff0\u3002<\/p>\n<p>git cat-file -p 4b1a3958c0889c77218bbe85240b26bf51b95a0d <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"188\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232526-6ad7f8660bdb3.png\" width=\"1275\" \/><\/p>\n<p>\u53ef\u4ee5\u770b\u5230&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4e0a\u4e00\u6b21\u63d0\u4ea4\u7684 commit ID<\/p>\n<\/li>\n<li>\n<p>\u63d0\u4ea4\u8005\u4fe1\u606f<\/p>\n<\/li>\n<li>\n<p>\u63d0\u4ea4\u63cf\u8ff0&#xff0c;\u4e5f\u5c31\u662f git commit -m &#034;XXX&#034; \u4e2d\u8f93\u5165\u7684\u63cf\u8ff0<\/p>\n<\/li>\n<\/ul>\n<p>\u7ee7\u7eed\u67e5\u770b\u5176\u4e2d\u7684 tree \u5bf9\u8c61&#xff1a;<\/p>\n<p>git cat-file -p e64dd387eab7b264b10b76d9bbcbd26cabd7938f <\/p>\n<p>tree \u5bf9\u8c61\u8bb0\u5f55\u7684\u662f\u76ee\u5f55\u7ed3\u6784\u548c\u6587\u4ef6\u5feb\u7167\u4fe1\u606f\u3002\u4e5f\u5c31\u662f\u8bf4&#xff0c;\u6bcf\u6b21 commit \u64cd\u4f5c\u90fd\u4f1a\u751f\u6210\u6216\u5f15\u7528 Git \u5bf9\u8c61&#xff0c;\u5e76\u5b58\u653e\u5230 .git\/objects \u4e2d\u3002<\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u65b9\u5f0f\u67e5\u770b\u67d0\u4e2a\u63d0\u4ea4&#xff1a;<\/p>\n<p>git cat-file -p &lt;commit-id&gt; <\/p>\n<p>\u9700\u8981\u7406\u89e3\u7684\u662f&#xff0c;Git \u5bf9\u8c61\u5e93\u4e2d\u4e3b\u8981\u5305\u542b&#xff1a;<\/p>\n<ul>\n<li>\n<p>blob&#xff1a;\u6587\u4ef6\u5185\u5bb9<\/p>\n<\/li>\n<li>\n<p>tree&#xff1a;\u76ee\u5f55\u7ed3\u6784<\/p>\n<\/li>\n<li>\n<p>commit&#xff1a;\u63d0\u4ea4\u4fe1\u606f<\/p>\n<\/li>\n<\/ul>\n<p>\u6240\u4ee5 Git \u5b58\u50a8\u7684\u4e0d\u662f\u7b80\u5355\u7684\u4e00\u6574\u4e2a\u6587\u4ef6\u526f\u672c&#xff0c;\u800c\u662f\u57fa\u4e8e\u5185\u5bb9\u7684\u5bf9\u8c61\u548c\u5feb\u7167\u3002<\/p>\n<h3 id=\"11.%20%E9%AA%8C%E8%AF%81%20commit%20%E5%8F%AA%E6%8F%90%E4%BA%A4%E6%9A%82%E5%AD%98%E5%8C%BA%E5%86%85%E5%AE%B9\">11. \u9a8c\u8bc1 commit \u53ea\u63d0\u4ea4\u6682\u5b58\u533a\u5185\u5bb9<\/h3>\n<p>\u67e5\u770b\u5f53\u524d\u6587\u4ef6\u4f7f\u7528 la \u547d\u4ee4 \u53d1\u73b0\u53ea\u6709file1 file2 file3 ReadME .git<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"66\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232526-6ad7f8662b96e.png\" width=\"711\" \/><\/p>\n<p>\u4f7f\u7528 touch file4 \u521b\u5efa\u51fa file4\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"113\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232526-6ad7f86639189.png\" width=\"954\" \/><\/p>\n<p>\u4f7f\u7528 git add file4 \u5c06 file4 \u653e\u5165\u6682\u5b58\u533a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"318\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232526-6ad7f8664c0da.png\" width=\"1038\" \/><\/p>\n<p>\u73b0\u5728\u4f7f\u7528 touch file5 \u521b\u5efa file5 \u6587\u4ef6<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"146\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232526-6ad7f8667c753.png\" width=\"747\" \/><\/p>\n<p>\u4f7f\u7528 git commit -m &#034;add file&#034; \u63d0\u4ea4\u5230\u672c\u5730\u4ed3\u5e93&#xff0c;\u53d1\u73b0\u53ea\u6709 file4 \u88ab\u63d0\u4ea4\u4e86&#xff0c;file5 \u6ca1\u6709\u88ab\u63d0\u4ea4\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"114\" src=\"2026-10-21wqixg2b0da4.png\" width=\"858\" \/><\/p>\n<p>\u4f7f\u7528 git status \u67e5\u770b\u53d1\u73b0 file5 \u5e76\u6ca1\u6709\u8fdb\u5165\u6682\u5b58\u533a\u4e2d&#xff0c;\u6240\u4ee5\u6ca1\u6709\u88ab\u63d0\u4ea4<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"288\" src=\"2026-10-21wpgzf535l4q.png\" width=\"964\" \/><\/p>\n<p>git \u8ffd\u8e2a\u7ba1\u7406\u662f\u4fee\u6539&#xff0c;\u800c\u4e0d\u662f\u6587\u4ef6<\/p>\n<p>\u5b83\u7684objects \u5bf9\u8c61\u5e93\u91cc\u9762\u5b58\u50a8\u7684\u662f\u6211\u4eec\u4fee\u6539\u7684\u5185\u5bb9&#xff0c;\u800c\u4e0d\u662f\u4e00\u9635\u4e2a\u6587\u4ef6<\/p>\n<h3 id=\"12.%20Git%20%E7%AE%A1%E7%90%86%E7%9A%84%E6%98%AF%E5%86%85%E5%AE%B9%E5%8F%98%E5%8C%96\">12. Git \u7ba1\u7406\u7684\u662f\u5185\u5bb9\u53d8\u5316<\/h3>\n<p>Git \u8ffd\u8e2a\u7ba1\u7406\u7684\u662f\u4fee\u6539\u548c\u5185\u5bb9\u5feb\u7167&#xff0c;\u800c\u4e0d\u662f\u7b80\u5355\u5730\u201c\u6309\u6587\u4ef6\u201d\u7ba1\u7406\u3002<\/p>\n<p>\u5bf9\u8c61\u5e93\u4e2d\u5b58\u50a8\u7684\u662f Git \u5bf9\u8c61&#xff0c;\u4f8b\u5982\u6587\u4ef6\u5185\u5bb9\u5bf9\u8c61\u3001\u76ee\u5f55\u6811\u5bf9\u8c61\u548c\u63d0\u4ea4\u5bf9\u8c61\u3002\u6bcf\u6b21\u63d0\u4ea4\u4f1a\u6839\u636e\u6682\u5b58\u533a\u751f\u6210\u5feb\u7167&#xff0c;\u672a\u53d8\u5316\u7684\u5185\u5bb9\u901a\u5e38\u4f1a\u590d\u7528\u5df2\u6709\u5bf9\u8c61\u3002<\/p>\n<h3 id=\"13.%20%E4%BF%AE%E6%94%B9%20ReadME%20%E5%B9%B6%E6%9F%A5%E7%9C%8B%20diff\">13. \u4fee\u6539 ReadME \u5e76\u67e5\u770b diff<\/h3>\n<p>\u4f7f\u7528 vim ReadME \u4fee\u6539 ReadME \u6587\u4ef6<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"178\" src=\"2026-10-21efsr2kwc5er.png\" width=\"402\" \/><\/p>\n<p>\u628a hello hello \u4fee\u6539\u4e3a hello \u4f60\u597d&#xff01;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"213\" src=\"2026-10-21slp5isjlcfe.png\" width=\"548\" \/><\/p>\n<p>\u4f7f\u7528 esc &#xff0c;\u8f93\u5165 :wq \u4fdd\u5b58\u9000\u51fa&#xff0c;\u8fd9\u65f6\u5019\u5de5\u4f5c\u533a\u4e2d\u7684 ReadME \u6587\u4ef6\u5df2\u7ecf\u88ab\u4fee\u6539<\/p>\n<p>\u4f7f\u7528 git status \u547d\u4ee4\u67e5\u770b git \u72b6\u6001&#xff0c;\u53d1\u73b0git\u5df2\u7ecf\u53d1\u73b0 ReadME \u6587\u4ef6\u88ab\u4fee\u6539&#xff0c;\u800c\u4e14\u6682\u5b58\u533a\u4e2d\u65e0\u5185\u5bb9<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"234\" src=\"2026-10-21oosajkaopyf.png\" width=\"1029\" \/><\/p>\n<p>\u00a0\u4f7f\u7528 git diff ReadME \u547d\u4ee4\u67e5\u770b\u00a0ReadME \u6587\u4ef6&#xff0c;\u8fd9\u91cc a \u662f\u6539\u52a8\u524d&#xff08;\u7248\u672c\u5e93\u4e2d\u5b58\u5728\u7684&#xff09;&#xff0c;b \u662f\u6539\u52a8\u540e&#xff08;\u5de5\u4f5c\u533a\u4e2d\u7684&#xff09;<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"263\" src=\"2026-10-2134zssdppda4.png\" width=\"783\" \/><\/p>\n<h3 id=\"14.%20%E6%8F%90%E4%BA%A4%20ReadME%20%E4%BF%AE%E6%94%B9\">14. \u63d0\u4ea4 ReadME \u4fee\u6539<\/h3>\n<p>\u4f7f\u7528 git add ReadME \u548c git status \u63d0\u4ea4\u5e76\u67e5\u770bgit \u72b6\u6001&#xff0c;\u53d1\u73b0\u4ed6\u8bf4\u6211\u4eec\u9700\u8981\u5c06\u6539\u53d8\u63d0\u4ea4\u5230\u672c\u5730\u4ed3\u5e93<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"181\" src=\"2026-10-211rypr54wiro.png\" width=\"861\" \/><\/p>\n<p>\u4f7f\u7528git commit -m &#034;modify ReadME&#034; \u63d0\u4ea4 ReadMe \u6587\u4ef6<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"113\" src=\"2026-10-210zrgpj1wjjn.png\" width=\"964\" \/><\/p>\n<p>\u4f7f\u7528 git status \u67e5\u770b\u4f60\u53d1\u73b0\u6682\u5b58\u533a\u662f\u5e72\u51c0\u7684&#xff0c;\u6ca1\u6709\u9700\u8981commit\u7684\u6587\u4ef6<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"120\" src=\"2026-10-21kspsivmknhw.png\" width=\"907\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55<br \/>\n1. \u521b\u5efa\u6587\u4ef6<br \/>\n2. \u5c06 file1 \u6dfb\u52a0\u5230\u6682\u5b58\u533a<br \/>\n3. \u67e5\u770b Git \u72b6\u6001<br \/>\n4. \u63d0\u4ea4 file1<br \/>\n5. \u518d\u6b21\u67e5\u770b\u72b6\u6001<br \/>\n6. \u67e5\u770b\u63d0\u4ea4\u65e5\u5fd7<br \/>\n7. \u63d0\u4ea4 file2 \u548c file3<br \/>\n8. \u4e00\u884c\u663e\u793a Git \u65e5\u5fd7<br \/>\n9. \u89c2\u5bdf .git \u76ee\u5f55\u53d8\u5316<br \/>\n10. \u67e5\u770b Git \u5bf9\u8c61<br \/>\n11. \u9a8c\u8bc1 commit \u53ea\u63d0\u4ea4\u6682\u5b58\u533a\u5185\u5bb9<br \/>\n12. Git \u7ba1\u7406\u7684\u662f\u5185\u5bb9\u53d8\u5316<br \/>\n13. \u4fee\u6539 ReadME \u5e76\u67e5\u770b diff<br \/>\n14. \u63d0\u4ea4 ReadME \u4fee\u6539 \u672c\u6587\u8bb0\u5f55 Gi<\/p>\n","protected":false},"author":2,"featured_media":116325,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[11820,89],"topic":[],"class_list":["post-116345","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-atomgit","tag-git"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Git \u57fa\u7840\u64cd\u4f5c\u4e0e\u5bf9\u8c61\u89c2\u5bdf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/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.wsisp.com\/helps\/116345.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git \u57fa\u7840\u64cd\u4f5c\u4e0e\u5bf9\u8c61\u89c2\u5bdf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u5f55 1. \u521b\u5efa\u6587\u4ef6 2. \u5c06 file1 \u6dfb\u52a0\u5230\u6682\u5b58\u533a 3. \u67e5\u770b Git \u72b6\u6001 4. \u63d0\u4ea4 file1 5. \u518d\u6b21\u67e5\u770b\u72b6\u6001 6. \u67e5\u770b\u63d0\u4ea4\u65e5\u5fd7 7. \u63d0\u4ea4 file2 \u548c file3 8. \u4e00\u884c\u663e\u793a Git \u65e5\u5fd7 9. \u89c2\u5bdf .git \u76ee\u5f55\u53d8\u5316 10. \u67e5\u770b Git \u5bf9\u8c61 11. \u9a8c\u8bc1 commit \u53ea\u63d0\u4ea4\u6682\u5b58\u533a\u5185\u5bb9 12. Git \u7ba1\u7406\u7684\u662f\u5185\u5bb9\u53d8\u5316 13. \u4fee\u6539 ReadME \u5e76\u67e5\u770b diff 14. \u63d0\u4ea4 ReadME \u4fee\u6539 \u672c\u6587\u8bb0\u5f55 Gi\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/116345.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-20T23:25:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232521-6ad7f8615fd0e.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/116345.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/116345.html\",\"name\":\"Git \u57fa\u7840\u64cd\u4f5c\u4e0e\u5bf9\u8c61\u89c2\u5bdf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-20T23:25:27+00:00\",\"dateModified\":\"2026-10-20T23:25:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/116345.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/116345.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/116345.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Git \u57fa\u7840\u64cd\u4f5c\u4e0e\u5bf9\u8c61\u89c2\u5bdf\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Git \u57fa\u7840\u64cd\u4f5c\u4e0e\u5bf9\u8c61\u89c2\u5bdf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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.wsisp.com\/helps\/116345.html","og_locale":"zh_CN","og_type":"article","og_title":"Git \u57fa\u7840\u64cd\u4f5c\u4e0e\u5bf9\u8c61\u89c2\u5bdf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u76ee\u5f55 1. \u521b\u5efa\u6587\u4ef6 2. \u5c06 file1 \u6dfb\u52a0\u5230\u6682\u5b58\u533a 3. \u67e5\u770b Git \u72b6\u6001 4. \u63d0\u4ea4 file1 5. \u518d\u6b21\u67e5\u770b\u72b6\u6001 6. \u67e5\u770b\u63d0\u4ea4\u65e5\u5fd7 7. \u63d0\u4ea4 file2 \u548c file3 8. \u4e00\u884c\u663e\u793a Git \u65e5\u5fd7 9. \u89c2\u5bdf .git \u76ee\u5f55\u53d8\u5316 10. \u67e5\u770b Git \u5bf9\u8c61 11. \u9a8c\u8bc1 commit \u53ea\u63d0\u4ea4\u6682\u5b58\u533a\u5185\u5bb9 12. Git \u7ba1\u7406\u7684\u662f\u5185\u5bb9\u53d8\u5316 13. \u4fee\u6539 ReadME \u5e76\u67e5\u770b diff 14. \u63d0\u4ea4 ReadME \u4fee\u6539 \u672c\u6587\u8bb0\u5f55 Gi","og_url":"https:\/\/www.wsisp.com\/helps\/116345.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-20T23:25:27+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020232521-6ad7f8615fd0e.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/116345.html","url":"https:\/\/www.wsisp.com\/helps\/116345.html","name":"Git \u57fa\u7840\u64cd\u4f5c\u4e0e\u5bf9\u8c61\u89c2\u5bdf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-20T23:25:27+00:00","dateModified":"2026-10-20T23:25:27+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/116345.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/116345.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/116345.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Git \u57fa\u7840\u64cd\u4f5c\u4e0e\u5bf9\u8c61\u89c2\u5bdf"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/116345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=116345"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/116345\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/116325"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=116345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=116345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=116345"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=116345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}