{"id":25156,"date":"2022-11-12T21:16:32","date_gmt":"2022-11-12T13:16:32","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=25156"},"modified":"2022-11-12T21:16:42","modified_gmt":"2022-11-12T13:16:42","slug":"first-git-warehouse","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/first-git-warehouse.html","title":{"rendered":"\u770b\u5b8c\u8fd9\u7bc7\u6587\u7ae0\uff0c\u4f60\u5c31\u5df2\u7ecf\u5b66\u4f1a\u4e86Git\u4ed3\u5e93\u6280\u672f"},"content":{"rendered":"
<\/p>\n
\u867d\u7136 Git \u786e\u5b9e\u662f\u88ab\u8bb8\u591a\u91cd\u8981\u8f6f\u4ef6\u9009\u4f5c\u7248\u672c\u63a7\u5236\u5de5\u5177\uff0c\u4f46\u662f\u5e76\u4e0d\u662f\u4ec5\u80fd\u7528\u4e8e\u8fd9\u4e9b\u91cd\u8981\u8f6f\u4ef6;\u5b83\u4e5f\u80fd\u7ba1\u7406\u4f60\u8d2d\u7269\u6e05\u5355(\u5982\u679c\u5b83\u4eec\u5bf9\u4f60\u6765\u8bf4\u5f88\u91cd\u8981\u7684\u8bdd\uff0c\u5f53\u7136\u53ef\u4ee5\u4e86!)\u3001\u4f60\u7684\u914d\u7f6e\u6587\u4ef6\u3001\u5468\u62a5\u6216\u65e5\u8bb0\u3001\u9879\u76ee\u8fdb\u5c55\u65e5\u5fd7\u3001\u751a\u81f3\u6e90\u4ee3\u7801!<\/p>\n
\u4f7f\u7528 Git \u662f\u5f88\u6709\u5fc5\u8981\u7684\uff0c\u6bd5\u7adf\uff0c\u4f60\u80af\u5b9a\u6709\u8fc7\u56e0\u4e3a\u4e00\u4e2a\u5907\u4efd\u6587\u4ef6\u4e0d\u80fd\u591f\u8fa8\u8ba4\u51fa\u7248\u672c\u4fe1\u606f\u800c\u6293\u72c2\u7684\u65f6\u5019\u3002<\/p>\n
Git \u65e0\u6cd5\u5e2e\u52a9\u4f60\uff0c\u9664\u975e\u4f60\u5f00\u59cb\u4f7f\u7528\u5b83\uff0c\u800c\u73b0\u5728\u5c31\u662f\u5f00\u59cb\u5b66\u4e60\u548c\u4f7f\u7528\u5b83\u7684\u6700\u597d\u65f6\u673a\u3002\u6216\u8005\uff0c\u7528 Git \u7684\u8bdd\u6765\u8bf4\uff0c\u201c\u6ca1\u6709\u5176\u4ed6\u7684 push \u80fd\u50cf origin HEAD \u4e00\u6837\u6709\u5e2e\u52a9\u4e86\u201d(\u5343\u91cc\u4e4b\u884c\u59cb\u4e8e\u8db3\u4e0b\u7684\u610f\u601d)\u3002\u6211\u4fdd\u8bc1\uff0c\u4f60\u5f88\u5feb\u5c31\u4f1a\u7406\u89e3\u8fd9\u4e00\u70b9\u7684\u3002<\/p>\n
\u6211\u4eec\u7ecf\u5e38\u7528\u540d\u8bcd\u201c\u5feb\u7167\u201d\u6765\u6307\u4ee3\u8ba1\u7b97\u673a\u4e0a\u7684\u955c\u50cf\uff0c\u56e0\u4e3a\u5f88\u591a\u4eba\u90fd\u80fd\u591f\u5bf9\u63d2\u6ee1\u4e86\u4e0d\u540c\u65f6\u5149\u7684\u7167\u7247\u7684\u76f8\u518c\u5145\u6ee1\u4e86\u611f\u53d7\u3002\u8fd9\u5f88\u6709\u7528\uff0c\u4e0d\u8fc7\uff0c\u6211\u8ba4\u4e3a Git \u66f4\u50cf\u662f\u8fdb\u884c\u4e00\u573a\u5f55\u97f3\u3002<\/p>\n
\u4e5f\u8bb8\u4f60\u4e0d\u592a\u719f\u6089\u4f20\u7edf\u7684\u5f55\u97f3\u68da\u5361\u5ea7\u5f0f\u5f55\u97f3\u673a\uff0c\u5b83\u5305\u62ec\u51e0\u4e2a\u90e8\u4ef6\uff1a\u4e00\u4e2a\u53ef\u4ee5\u6b63\u8f6c\u6216\u53cd\u8f6c\u7684\u8f6c\u8f74\u3001\u4fdd\u5b58\u58f0\u97f3\u6ce2\u5f62\u7684\u78c1\u5e26\uff0c\u53ef\u4ee5\u901a\u8fc7\u62fe\u97f3\u5934\u5728\u78c1\u5e26\u4e0a\u8bb0\u5f55\u58f0\u97f3\u6ce2\u5f62\uff0c\u6216\u8005\u68c0\u6d4b\u5230\u78c1\u5e26\u4e0a\u7684\u58f0\u97f3\u6ce2\u5f62\u5e76\u64ad\u653e\u7ed9\u542c\u4f17\u3002<\/p>\n
\u9664\u4e86\u5f80\u524d\u64ad\u653e\u78c1\u5e26\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a\u78c1\u5e26\u5012\u56de\u5230\u4e4b\u524d\u7684\u90e8\u5206\uff0c\u6216\u5feb\u8fdb\u8df3\u8fc7\u540e\u9762\u7684\u90e8\u5206\u3002<\/p>\n
\u60f3\u8c61\u4e00\u4e0b\u4e0a\u4e16\u7eaa 70 \u5e74\u4ee3\u4e50\u961f\u5f55\u5236\u78c1\u5e26\u7684\u60c5\u5f62\u3002\u4f60\u53ef\u4ee5\u60f3\u8c61\u5230\u4ed6\u4eec\u4e00\u904d\u904d\u5730\u7ec3\u4e60\u6b4c\u66f2\uff0c\u76f4\u5230\u6240\u6709\u90e8\u5206\u90fd\u975e\u5e38\u5b8c\u7f8e\uff0c\u7136\u540e\u8bb0\u5f55\u5230\u97f3\u8f68\u4e0a\u3002\u8d77\u521d\uff0c\u4f60\u4f1a\u5f55\u4e0b\u9f13\u58f0\uff0c\u7136\u540e\u662f\u4f4e\u97f3\uff0c\u518d\u7136\u540e\u662f\u5409\u4ed6\u58f0\uff0c\u6700\u540e\u662f\u4e3b\u5531\u3002\u6bcf\u6b21\u4f60\u5f55\u97f3\u65f6\uff0c\u5f55\u97f3\u68da\u5de5\u4f5c\u4eba\u5458\u90fd\u4f1a\u628a\u78c1\u5e26\u5012\u5e26\uff0c\u7136\u540e\u8fdb\u5165\u5faa\u73af\u6a21\u5f0f\uff0c\u8fd9\u6837\u5b83\u5c31\u4f1a\u64ad\u653e\u4f60\u4e4b\u524d\u5f55\u5236\u7684\u90e8\u5206\u3002\u6bd4\u5982\u8bf4\u5982\u679c\u4f60\u6b63\u5728\u5f55\u5236\u4f4e\u97f3\uff0c\u4f60\u5c31\u4f1a\u5728\u80cc\u666f\u97f3\u4e50\u91cc\u542c\u5230\u9f13\u58f0\uff0c\u5c31\u50cf\u4f60\u81ea\u5df1\u5728\u51fb\u9f13\u4e00\u6837\uff0c\u7136\u540e\u5409\u4ed6\u624b\u5728\u5f55\u5236\u65f6\u4f1a\u542c\u5230\u9f13\u58f0\u3001\u4f4e\u97f3(\u548c\u725b\u94c3\u58f0)\u7b49\u7b49\u3002\u5728\u6bcf\u4e2a\u5faa\u73af\u4e2d\uff0c\u4f60\u90fd\u4f1a\u5f55\u5236\u4e00\u90e8\u5206\uff0c\u5728\u63a5\u4e0b\u6765\u7684\u5faa\u73af\u4e2d\uff0c\u5de5\u4f5c\u4eba\u5458\u5c31\u4f1a\u6309\u4e0b\u5f55\u97f3\u6309\u94ae\u5c06\u5176\u5408\u5e76\u8bb0\u5f55\u5230\u78c1\u5e26\u4e2d\u3002<\/p>\n
\u4f60\u4e5f\u53ef\u4ee5\u62f7\u8d1d\u6216\u6362\u4e0b\u6574\u4e2a\u78c1\u5e26\uff0c\u5982\u679c\u4f60\u8981\u5bf9\u4f60\u7684\u4f5c\u54c1\u91cd\u65b0\u6df7\u97f3\u7684\u8bdd\u3002<\/p>\n
\u73b0\u5728\u6211\u5e0c\u671b\u5bf9\u4e8e\u4e0a\u8ff0\u7684\u4e0a\u4e16\u7eaa 70 \u5e74\u4ee3\u7684\u5f55\u97f3\u5de5\u4f5c\u7684\u63cf\u8ff0\u8db3\u591f\u751f\u52a8\uff0c\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u628a Git \u7684\u5de5\u4f5c\u60f3\u8c61\u6210\u4e00\u4e2a\u5f55\u97f3\u5de5\u4f5c\u4e86\u3002<\/p>\n
\u9996\u5148\u5f97\u4e3a\u6211\u4eec\u7684\u865a\u62df\u7684\u5f55\u97f3\u673a\u4e70\u4e00\u4e9b\u78c1\u5e26\u3002\u7528 Git \u7684\u8bdd\u8bf4\uff0c\u8fd9\u4e9b\u78c1\u5e26\u5c31\u662f\u4ed3\u5e93;\u5b83\u662f\u5b8c\u6210\u6240\u6709\u5de5\u4f5c\u7684\u57fa\u7840\uff0c\u4e5f\u5c31\u662f\u8bf4\u8fd9\u91cc\u662f\u5b58\u653e Git \u6587\u4ef6\u7684\u5730\u65b9(\u5373 Git \u5de5\u4f5c\u533a)\u3002<\/p>\n
\u4efb\u4f55\u76ee\u5f55\u90fd\u53ef\u4ee5\u6210\u4e3a\u4e00\u4e2a Git \u4ed3\u5e93\uff0c\u4f46\u662f\u8ba9\u6211\u4eec\u4ece\u4e00\u4e2a\u65b0\u76ee\u5f55\u5f00\u59cb\u3002\u8fd9\u9700\u8981\u4e0b\u9762\u4e09\u4e2a\u547d\u4ee4\uff1a<\/p>\n
\u4e5f\u5c31\u662f\u8fd0\u884c\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n
$\u00a0mkdir\u00a0~\/jupiter\u00a0\u00a0#\u00a0\u521b\u5efa\u76ee\u5f55\r\n$\u00a0cd\u00a0~\/jupiter\u00a0\u00a0\u00a0\u00a0\u00a0#\u00a0\u8fdb\u5165\u76ee\u5f55\r\n$\u00a0git\u00a0init\u00a0.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u00a0\u521d\u59cb\u5316\u4f60\u7684\u65b0\u00a0Git\u00a0\u5de5\u4f5c\u533a\r\n<\/pre>\n\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6587\u4ef6\u5939 jupiter \u662f\u4e00\u4e2a\u7a7a\u7684\u4f46\u662f\u5408\u6cd5\u7684 Git \u4ed3\u5e93\u3002<\/p>\n
\u6709\u4e86\u4ed3\u5e93\u63a5\u4e0b\u6765\u7684\u4e8b\u60c5\u5c31\u53ef\u4ee5\u6309\u90e8\u5c31\u73ed\u8fdb\u884c\u4e86\u3002\u4f60\u53ef\u4ee5\u514b\u9686\u8be5\u4ed3\u5e93\uff0c\u4f60\u53ef\u4ee5\u5728\u4e00\u4e2a\u5386\u53f2\u70b9\u524d\u540e\u6765\u56de\u7a7f\u68ad(\u524d\u63d0\u662f\u4f60\u6709\u4e00\u4e2a\u5386\u53f2\u70b9)\uff0c\u521b\u5efa\u4ea4\u66ff\u7684\u65f6\u95f4\u7ebf\uff0c\u4ee5\u53ca\u505a Git \u80fd\u505a\u7684\u5176\u5b83\u4efb\u4f55\u4e8b\u60c5\u3002<\/p>\n
\u5728 Git \u4ed3\u5e93\u91cc\u9762\u5de5\u4f5c\u548c\u5728\u4efb\u4f55\u76ee\u5f55\u91cc\u9762\u5de5\u4f5c\u90fd\u662f\u4e00\u6837\u7684\uff0c\u53ef\u4ee5\u5728\u4ed3\u5e93\u4e2d\u65b0\u5efa\u6587\u4ef6\u3001\u590d\u5236\u6587\u4ef6\u3001\u4fdd\u5b58\u6587\u4ef6\u3002\u4f60\u53ef\u4ee5\u50cf\u5e73\u5e38\u4e00\u6837\u505a\u5404\u79cd\u4e8b\u60c5;Git \u5e76\u4e0d\u590d\u6742\uff0c\u9664\u975e\u4f60\u628a\u5b83\u60f3\u590d\u6742\u4e86\u3002<\/p>\n
\u5728\u672c\u5730\u7684 Git \u4ed3\u5e93\u4e2d\uff0c\u4e00\u4e2a\u6587\u4ef6\u53ef\u4ee5\u6709\u4ee5\u4e0b\u8fd9\u4e09\u79cd\u72b6\u6001\uff1a<\/p>\n
\u672a\u8ddf\u8e2a\u6587\u4ef6Untracked\uff1a\u4f60\u5728\u4ed3\u5e93\u91cc\u65b0\u5efa\u4e86\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u662f\u4f60\u6ca1\u6709\u628a\u6587\u4ef6\u52a0\u5165\u5230 Git \u7684\u7ba1\u7406\u4e4b\u4e2d\u3002
\n\u5df2\u8ddf\u8e2a\u6587\u4ef6Tracked\uff1a\u5df2\u7ecf\u52a0\u5165\u5230 Git \u7ba1\u7406\u7684\u6587\u4ef6\u3002
\n\u6682\u5b58\u533a\u6587\u4ef6Staged\uff1a\u88ab\u4fee\u6539\u4e86\u7684\u5df2\u8ddf\u8e2a\u6587\u4ef6\uff0c\u5e76\u52a0\u5165\u5230 Git \u7684\u63d0\u4ea4\u961f\u5217\u4e2d\u3002<\/div>\n\u4efb\u4f55\u4f60\u65b0\u52a0\u5165\u5230 Git \u4ed3\u5e93\u4e2d\u7684\u6587\u4ef6\u90fd\u662f\u672a\u8ddf\u8e2a\u6587\u4ef6\u3002\u8fd9\u4e9b\u6587\u4ef6\u4fdd\u5b58\u5728\u4f60\u7684\u7535\u8111\u786c\u76d8\u4e0a\uff0c\u4f46\u662f\u4f60\u6ca1\u6709\u544a\u8bc9 Git \u8fd9\u662f\u9700\u8981\u7ba1\u7406\u7684\u6587\u4ef6\uff0c\u7528\u6211\u4eec\u7684\u5f55\u97f3\u673a\u6765\u7c7b\u6bd4\uff0c\u5c31\u662f\u5f55\u97f3\u673a\u8fd8\u6ca1\u6253\u5f00;\u4e50\u961f\u5c31\u5f00\u59cb\u5728\u5f55\u97f3\u68da\u91cc\u5fd9\u788c\u4e86\uff0c\u4f46\u662f\u5f55\u97f3\u673a\u5e76\u6ca1\u6709\u51c6\u5907\u5f55\u97f3\u3002<\/p>\n
\u4e0d\u7528\u62c5\u5fc3\uff0cGit \u4f1a\u5728\u51fa\u73b0\u8fd9\u79cd\u60c5\u51b5\u65f6\u544a\u8bc9\u4f60\uff1a<\/p>\n
$\u00a0echo\u00a0\"hello\u00a0world\"\u00a0>\u00a0foo\r\n$\u00a0git\u00a0status\r\nOn\u00a0branch\u00a0master\r\nUntracked\u00a0files:\r\n(use\u00a0\"git\u00a0add\u00a0<file>...\"\u00a0to\u00a0include\u00a0in\u00a0what\u00a0will\u00a0be\u00a0committed)\r\n\u00a0\u00a0\u00a0\u00a0foo\r\nnothing\u00a0added\u00a0but\u00a0untracked\u00a0files\u00a0present\u00a0(use\u00a0\"git\u00a0add\"\u00a0to\u00a0track)\r\n<\/pre>\n\u4f60\u770b\u5230\u4e86\uff0cGit \u4f1a\u63d0\u9192\u4f60\u600e\u6837\u628a\u6587\u4ef6\u52a0\u5165\u5230\u63d0\u4ea4\u4efb\u52a1\u4e2d\u3002<\/p>\n
\u4e0d\u4f7f\u7528 Git \u547d\u4ee4\u8fdb\u884c Git \u64cd\u4f5c<\/strong><\/div>\n\u5728 GitHub \u6216 GitLab \u4e0a\u521b\u5efa\u4e00\u4e2a\u4ed3\u5e93\u53ea\u9700\u8981\u7528\u9f20\u6807\u70b9\u51e0\u4e0b\u5373\u53ef\u3002\u8fd9\u5e76\u4e0d\u96be\uff0c\u4f60\u5355\u51fb\u201cNew Repository\u201d\u8fd9\u4e2a\u6309\u94ae\u7136\u540e\u8ddf\u7740\u63d0\u793a\u505a\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n
\u5728\u4ed3\u5e93\u4e2d\u5305\u62ec\u4e00\u4e2a\u201cREADME\u201d\u6587\u4ef6\u662f\u4e00\u4e2a\u597d\u4e60\u60ef\uff0c\u8fd9\u6837\u4eba\u4eec\u5728\u6d4f\u89c8\u4f60\u7684\u4ed3\u5e93\u7684\u65f6\u5019\u5c31\u53ef\u4ee5\u77e5\u9053\u4f60\u7684\u4ed3\u5e93\u662f\u5e72\u4ec0\u4e48\u7684\uff0c\u66f4\u6709\u7528\u7684\u662f\u53ef\u4ee5\u8ba9\u4f60\u5728\u514b\u9686\u4e00\u4e2a\u6709\u4e1c\u897f\u7684\u4ed3\u5e93\u524d\u77e5\u9053\u5b83\u6709\u4e9b\u4ec0\u4e48\u3002<\/p>\n
\u514b\u9686\u4ed3\u5e93\u901a\u5e38\u5f88\u7b80\u5355\uff0c\u4f46\u662f\u5728 GitHub \u4e0a\u83b7\u53d6\u4ed3\u5e93\u6539\u52a8\u6743\u9650\u5c31\u7a0d\u5fae\u590d\u6742\u4e00\u4e9b\uff0c\u4e3a\u4e86\u901a\u8fc7 GitHub \u9a8c\u8bc1\u4f60\u5fc5\u987b\u6709\u4e00\u4e2a SSH \u5bc6\u94a5\u3002\u5982\u679c\u4f60\u4f7f\u7528 Linux \u7cfb\u7edf\uff0c\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u547d\u4ee4\u751f\u6210\uff1a<\/p>\n
$\u00a0ssh-keygen<\/pre>\n\u7136\u540e\u590d\u5236\u4f60\u7684\u65b0\u5bc6\u94a5\u7684\u5185\u5bb9\uff0c\u5b83\u662f\u7eaf\u6587\u672c\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u5b83\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b cat \u547d\u4ee4\u67e5\u770b\uff1a<\/p>\n
$\u00a0cat\u00a0~\/.ssh\/id_rsa.pub<\/pre>\n\u73b0\u5728\u628a\u4f60\u7684\u5bc6\u94a5\u7c98\u8d34\u5230 GitHub SSH \u914d\u7f6e\u6587\u4ef6 \u4e2d\uff0c\u6216\u8005 GitLab \u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n
\u5982\u679c\u4f60\u901a\u8fc7\u4f7f\u7528 SSH \u6a21\u5f0f\u514b\u9686\u4e86\u4f60\u7684\u9879\u76ee\uff0c\u4f60\u5c31\u53ef\u4ee5\u5c06\u4fee\u6539\u5199\u56de\u5230\u4f60\u7684\u4ed3\u5e93\u4e86\u3002<\/p>\n
\u53e6\u5916\uff0c\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u4e0a\u6ca1\u6709\u5b89\u88c5 Git \u7684\u8bdd\u4e5f\u53ef\u4ee5\u4f7f\u7528 GitHub \u7684\u6587\u4ef6\u4e0a\u4f20\u63a5\u53e3\u6765\u6dfb\u52a0\u6587\u4ef6\u3002<\/p>\n
<\/a><\/p>\n
\u8ddf\u8e2a\u6587\u4ef6<\/strong><\/div>\n\u6b63\u5982\u547d\u4ee4 git status \u7684\u8f93\u51fa\u544a\u8bc9\u4f60\u7684\u90a3\u6837\uff0c\u5982\u679c\u4f60\u60f3\u8ba9 git \u8ddf\u8e2a\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f60\u5fc5\u987b\u4f7f\u7528\u547d\u4ee4 git add \u628a\u5b83\u52a0\u5165\u5230\u63d0\u4ea4\u4efb\u52a1\u4e2d\u3002\u8fd9\u4e2a\u547d\u4ee4\u628a\u6587\u4ef6\u5b58\u5728\u4e86\u6682\u5b58\u533a\uff0c\u8fd9\u91cc\u5b58\u653e\u7684\u90fd\u662f\u7b49\u5f85\u63d0\u4ea4\u7684\u6587\u4ef6\uff0c\u6216\u8005\u4e5f\u53ef\u4ee5\u7528\u5728\u5feb\u7167\u4e2d\u3002\u5728\u5c06\u6587\u4ef6\u5305\u62ec\u5230\u5feb\u7167\u4e2d\uff0c\u548c\u6dfb\u52a0\u8981 Git \u7ba1\u7406\u7684\u65b0\u7684\u6216\u4e34\u65f6\u6587\u4ef6\u65f6\uff0cgit add \u547d\u4ee4\u7684\u76ee\u7684\u662f\u4e0d\u540c\u7684\uff0c\u4e0d\u8fc7\u81f3\u5c11\u73b0\u5728\uff0c\u4f60\u4e0d\u7528\u4e3a\u5b83\u4eec\u4e4b\u95f4\u7684\u4e0d\u540c\u4e4b\u5904\u800c\u8d39\u795e\u3002<\/p>\n
\u7c7b\u6bd4\u5f55\u97f3\u673a\uff0c\u8fd9\u4e2a\u52a8\u4f5c\u5c31\u50cf\u6253\u5f00\u5f55\u97f3\u673a\u5f00\u59cb\u51c6\u5907\u5f55\u97f3\u4e00\u6837\u3002\u4f60\u53ef\u4ee5\u60f3\u8c61\u4e3a\u5bf9\u5df2\u7ecf\u5728\u5f55\u97f3\u7684\u5f55\u97f3\u673a\u6309\u4e0b\u6682\u505c\u6309\u94ae\uff0c\u6216\u8005\u5012\u56de\u5f00\u5934\u7b49\u7740\u8bb0\u5f55\u4e0b\u4e2a\u97f3\u8f68\u3002<\/p>\n
\u5f53\u4f60\u628a\u6587\u4ef6\u6dfb\u52a0\u5230 Git \u7ba1\u7406\u4e2d\uff0c\u5b83\u4f1a\u6807\u8bc6\u5176\u4e3a\u5df2\u8ddf\u8e2a\u6587\u4ef6\uff1a<\/p>\n
$\u00a0git\u00a0add\u00a0foo\r\n$\u00a0git\u00a0status\r\nOn\u00a0branch\u00a0master\r\nChanges\u00a0to\u00a0be\u00a0committed:\r\n(use\u00a0\"git\u00a0reset\u00a0HEAD\u00a0<file>...\"\u00a0to\u00a0unstage)\r\nnew\u00a0file:\u00a0\u00a0\u00a0foo\r\n<\/pre>\n\u52a0\u5165\u6587\u4ef6\u5230\u63d0\u4ea4\u4efb\u52a1\u4e2d\u5e76\u4e0d\u662f\u201c\u51c6\u5907\u5f55\u97f3\u201d\u3002\u8fd9\u4ec5\u4ec5\u662f\u5c06\u8be5\u6587\u4ef6\u7f6e\u4e8e\u51c6\u5907\u5f55\u97f3\u7684\u72b6\u6001\u3002\u5728\u4f60\u6dfb\u52a0\u6587\u4ef6\u540e\uff0c\u4f60\u4ecd\u7136\u53ef\u4ee5\u4fee\u6539\u8be5\u6587\u4ef6;\u5b83\u53ea\u662f\u88ab\u6807\u8bb0\u4e3a\u5df2\u8ddf\u8e2a\u548c\u5904\u4e8e\u6682\u5b58\u533a\uff0c\u6240\u4ee5\u5728\u5b83\u88ab\u5199\u5230\u201c\u78c1\u5e26\u201d\u524d\u4f60\u53ef\u4ee5\u5c06\u5b83\u64a4\u51fa\u6216\u4fee\u6539\u5b83(\u5f53\u7136\u4f60\u4e5f\u53ef\u4ee5\u518d\u6b21\u5c06\u5b83\u52a0\u5165\u6765\u505a\u4e9b\u4fee\u6539)\u3002\u4f46\u662f\u8bf7\u6ce8\u610f\uff1a\u4f60\u8fd8\u6ca1\u6709\u5728\u78c1\u5e26\u4e2d\u8bb0\u5f55\u8be5\u6587\u4ef6\uff0c\u6240\u4ee5\u5982\u679c\u5f04\u574f\u4e86\u4e00\u4e2a\u4e4b\u524d\u8fd8\u662f\u597d\u7684\u6587\u4ef6\uff0c\u4f60\u662f\u6ca1\u6709\u529e\u6cd5\u6062\u590d\u7684\uff0c\u56e0\u4e3a\u4f60\u6ca1\u6709\u5728\u201c\u78c1\u5e26\u201d\u4e2d\u8bb0\u4e0b\u90a3\u4e2a\u6587\u4ef6\u8fd8\u662f\u597d\u7740\u7684\u65f6\u523b\u3002<\/p>\n
\u5982\u679c\u4f60\u6700\u540e\u51b3\u5b9a\u4e0d\u628a\u6587\u4ef6\u8bb0\u5f55\u5230 Git \u5386\u53f2\u5217\u8868\u4e2d\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u64a4\u9500\u63d0\u4ea4\u4efb\u52a1\uff0c\u5728 Git \u4e2d\u662f\u8fd9\u6837\u505a\u7684\uff1a<\/p>\n
$\u00a0git\u00a0reset\u00a0HEAD\u00a0foo<\/pre>\n\u8fd9\u5b9e\u9645\u4e0a\u5c31\u662f\u89e3\u9664\u4e86\u5f55\u97f3\u673a\u7684\u51c6\u5907\u5f55\u97f3\u72b6\u6001\uff0c\u4f60\u53ea\u662f\u5728\u5f55\u97f3\u68da\u4e2d\u8f6c\u4e86\u4e00\u5708\u800c\u5df2\u3002<\/p>\n
\u5927\u578b\u63d0\u4ea4<\/strong><\/div>\n\u6709\u65f6\u5019\uff0c\u4f60\u60f3\u8981\u63d0\u4ea4\u4e00\u4e9b\u5185\u5bb9\u5230\u4ed3\u5e93;\u6211\u4eec\u4ee5\u5f55\u97f3\u673a\u7c7b\u6bd4\uff0c\u8fd9\u5c31\u597d\u6bd4\u6309\u4e0b\u5f55\u97f3\u952e\u7136\u540e\u8bb0\u5f55\u5230\u78c1\u5e26\u4e2d\u4e00\u6837\u3002<\/p>\n
\u5728\u4e00\u4e2a\u9879\u76ee\u6240\u7ecf\u5386\u7684\u4e0d\u540c\u9636\u6bb5\u4e2d\uff0c\u4f60\u4f1a\u6309\u4e0b\u8fd9\u4e2a\u201c\u8bb0\u5f55\u952e\u201d\u65e0\u6570\u6b21\u3002\u6bd4\u5982\uff0c\u5982\u679c\u4f60\u5c1d\u8bd5\u4e86\u4e00\u4e2a\u65b0\u7684 Python \u5de5\u5177\u5305\u5e76\u4e14\u6700\u7ec8\u5b9e\u73b0\u4e86\u7a97\u53e3\u5448\u73b0\u529f\u80fd\uff0c\u7136\u540e\u4f60\u80af\u5b9a\u8981\u8fdb\u884c\u63d0\u4ea4\uff0c\u4ee5\u4fbf\u4f60\u5728\u5b9e\u9a8c\u65b0\u7684\u663e\u793a\u9009\u9879\u65f6\u641e\u7838\u4e86\u53ef\u4ee5\u56de\u9000\u5230\u8fd9\u4e2a\u9636\u6bb5\u3002\u4f46\u662f\u5982\u679c\u4f60\u5728 Inkscape \u4e2d\u753b\u4e86\u4e00\u4e9b\u56fe\u5f62\u8349\u6837\uff0c\u5728\u63d0\u4ea4\u524d\u4f60\u53ef\u80fd\u9700\u8981\u7b49\u5230\u5df2\u7ecf\u6709\u4e86\u4e00\u4e9b\u8981\u5f00\u53d1\u7684\u5185\u5bb9\u3002\u5c3d\u7ba1\u4f60\u53ef\u80fd\u63d0\u4ea4\u4e86\u5f88\u591a\u6b21\uff0c\u4f46\u662f Git \u5e76\u4e0d\u4f1a\u6d6a\u8d39\u5f88\u591a\uff0c\u4e5f\u4e0d\u4f1a\u5360\u7528\u592a\u591a\u78c1\u76d8\u7a7a\u95f4\uff0c\u6240\u4ee5\u5728\u6211\u770b\u6765\uff0c\u63d0\u4ea4\u7684\u8d8a\u591a\u8d8a\u597d\u3002<\/p>\n
<\/p>\n
commit \u547d\u4ee4\u4f1a\u201c\u8bb0\u5f55\u201d\u4ed3\u5e93\u4e2d\u6240\u6709\u7684\u6682\u5b58\u533a\u6587\u4ef6\u3002Git \u53ea\u201c\u8bb0\u5f55\u201d\u5df2\u8ddf\u8e2a\u7684\u6587\u4ef6\uff0c\u5373\uff0c\u5728\u8fc7\u53bb\u67d0\u4e2a\u65f6\u95f4\u70b9\u4f60\u4f7f\u7528 git add \u547d\u4ee4\u52a0\u5165\u5230\u6682\u5b58\u533a\u7684\u6240\u6709\u6587\u4ef6\uff0c\u4ee5\u53ca\u4ece\u4e0a\u6b21\u63d0\u4ea4\u540e\u88ab\u6539\u52a8\u7684\u6587\u4ef6\u3002\u5982\u679c\u4e4b\u524d\u6ca1\u6709\u8fc7\u63d0\u4ea4\uff0c\u90a3\u4e48\u6240\u6709\u8ddf\u8e2a\u7684\u6587\u4ef6\u90fd\u5305\u542b\u5728\u8fd9\u6b21\u63d0\u4ea4\u4e2d\uff0c\u4ee5 Git \u7684\u89d2\u5ea6\u6765\u770b\uff0c\u8fd9\u662f\u4e00\u6b21\u975e\u5e38\u91cd\u8981\u7684\u4fee\u6539\uff0c\u56e0\u4e3a\u5b83\u4eec\u4ece\u6ca1\u653e\u5230\u4ed3\u5e93\u4e2d\u53d8\u6210\u4e86\u653e\u8fdb\u53bb\u3002<\/p>\n
\u5b8c\u6210\u4e00\u6b21\u63d0\u4ea4\u9700\u8981\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n
$\u00a0git\u00a0commit\u00a0-m\u00a0'My\u00a0great\u00a0project,\u00a0first\u00a0commit.'<\/pre>\n\u8fd9\u5c31\u4fdd\u5b58\u4e86\u6240\u6709\u63d0\u4ea4\u7684\u6587\u4ef6\uff0c\u4e4b\u540e\u53ef\u4ee5\u7528\u4e8e\u5176\u5b83\u64cd\u4f5c(\u6216\u8005\uff0c\u7528\u82f1\u56fd\u7535\u89c6\u5267\u300a\u795e\u79d8\u535a\u58eb\u300b\u4e2d\u65f6\u95f4\u9886\u4e3b\u6240\u8bb2\u7684 Gallifreyan \u8bed\u8bf4\uff0c\u5b83\u4eec\u6210\u4e3a\u4e86\u201c\u56fa\u5b9a\u7684\u65f6\u95f4\u70b9\u201d )\u3002\u8fd9\u4e0d\u4ec5\u662f\u4e00\u4e2a\u63d0\u4ea4\u4e8b\u4ef6\uff0c\u4e5f\u662f\u4e00\u4e2a\u4f60\u5728 Git \u65e5\u5fd7\u4e2d\u627e\u5230\u8be5\u63d0\u4ea4\u7684\u5f15\u7528\u6307\u9488\uff1a<\/p>\n
$\u00a0git\u00a0log\u00a0--oneline
\n55df4c2\u00a0My\u00a0great\u00a0project,\u00a0first\u00a0commit.<\/div>\n\u5982\u679c\u60f3\u6d4f\u89c8\u66f4\u591a\u4fe1\u606f\uff0c\u53ea\u9700\u8981\u4f7f\u7528\u4e0d\u5e26 --oneline \u9009\u9879\u7684 git log \u547d\u4ee4\u3002<\/p>\n
\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\u63d0\u4ea4\u65f6\u7684\u5f15\u7528\u53f7\u7801\u662f 55df4c2\u3002\u5b83\u88ab\u53eb\u505a\u201c\u63d0\u4ea4\u54c8\u5e0ccommit hash\u201d(LCTT \u8bd1\u6ce8\uff1a\u8fd9\u662f\u4e00\u4e2a SHA-1 \u7b97\u6cd5\u751f\u6210\u7684\u54c8\u5e0c\u7801\uff0c\u7528\u4e8e\u8868\u793a\u4e00\u4e2a git \u63d0\u4ea4\u5bf9\u8c61)\uff0c\u5b83\u4ee3\u8868\u7740\u521a\u624d\u4f60\u7684\u63d0\u4ea4\u6240\u5305\u542b\u7684\u6240\u6709\u65b0\u6539\u52a8\uff0c\u8986\u76d6\u5230\u4e86\u5148\u524d\u7684\u8bb0\u5f55\u4e0a\u3002\u5982\u679c\u4f60\u60f3\u8981\u201c\u5012\u56de\u201d\u5230\u4f60\u7684\u63d0\u4ea4\u5386\u53f2\u70b9\u4e0a\uff0c\u5c31\u53ef\u4ee5\u7528\u8fd9\u4e2a\u54c8\u5e0c\u4f5c\u4e3a\u4f9d\u636e\u3002<\/p>\n
\u4f60\u53ef\u4ee5\u628a\u8fd9\u4e2a\u54c8\u5e0c\u60f3\u8c61\u6210\u4e00\u4e2a\u58f0\u97f3\u78c1\u5e26\u4e0a\u7684 SMPTE \u65f6\u95f4\u7801\uff0c\u6216\u8005\u518d\u5f62\u8c61\u4e00\u70b9\uff0c\u8fd9\u5c31\u662f\u597d\u6bd4\u4e00\u4e2a\u9ed1\u80f6\u5531\u7247\u4e0a\u4e24\u9996\u4e0d\u540c\u7684\u6b4c\u4e4b\u95f4\u7684\u7a7a\u9699\uff0c\u6216\u662f\u4e00\u4e2a CD \u4e0a\u7684\u97f3\u8f68\u7f16\u53f7\u3002<\/p>\n
\u5f53\u4f60\u6539\u52a8\u4e86\u6587\u4ef6\u4e4b\u540e\u5e76\u4e14\u628a\u5b83\u4eec\u52a0\u5165\u5230\u63d0\u4ea4\u4efb\u52a1\u4e2d\uff0c\u6700\u7ec8\u5b8c\u6210\u63d0\u4ea4\uff0c\u8fd9\u5c31\u4f1a\u751f\u6210\u65b0\u7684\u63d0\u4ea4\u54c8\u5e0c\uff0c\u5b83\u4eec\u6bcf\u4e00\u4e2a\u6240\u6807\u793a\u7684\u5386\u53f2\u70b9\u90fd\u4ee3\u8868\u7740\u4f60\u7684\u4ea7\u54c1\u4e0d\u540c\u7684\u7248\u672c\u3002<\/p>\n
\u8fd9\u5c31\u662f Charlie Brown \u8fd9\u6837\u7684\u97f3\u4e50\u5bb6\u4eec\u4e3a\u4ec0\u4e48\u7528 Git \u4f5c\u4e3a\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u7684\u539f\u56e0\u3002<\/p>\n
\u5728\u63a5\u4e0b\u6765\u7684\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u4f1a\u8ba8\u8bba\u5173\u4e8e Git HEAD \u7684\u5404\u4e2a\u65b9\u9762\uff0c\u6211\u4eec\u4f1a\u771f\u6b63\u5730\u5411\u4f60\u63ed\u793a\u65f6\u95f4\u65c5\u884c\u7684\u79d8\u5bc6\u3002\u4e0d\u7528\u62c5\u5fc3\uff0c\u4f60\u53ea\u9700\u8981\u7ee7\u7eed\u8bfb\u4e0b\u53bb\u5c31\u884c\u4e86(\u6216\u8bb8\u4f60\u5df2\u7ecf\u5728\u8bfb\u4e86?)\u3002<\/p>\n
\n\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/os.51cto.com\/art\/201608\/515601.htm<\/a><\/p>\n