{"id":546,"date":"2024-09-13T00:51:44","date_gmt":"2024-09-12T16:51:44","guid":{"rendered":"https:\/\/forelink.top\/?p=546"},"modified":"2024-09-13T00:51:46","modified_gmt":"2024-09-12T16:51:46","slug":"%e5%bf%bd%e7%95%a5%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/forelink.top\/index.php\/2024\/09\/13\/%e5%bf%bd%e7%95%a5%e6%96%87%e4%bb%b6\/","title":{"rendered":"\u5ffd\u7565\u6587\u4ef6"},"content":{"rendered":"\n<p>\u5ffd\u89c6\u9879\u76ee\u4e2d\u7684 .gitignore \u4f1a\u7559\u4e0b\u9690\u60a3\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"\u5728gitignore\u4e2d\u6dfb\u52a0\u914d\u7f6e\">\u5728.gitignore\u4e2d\u6dfb\u52a0\u914d\u7f6e<\/h1>\n\n\n\n<p>\u5982\u679c\u5728 Git \u7684\u5de5\u4f5c\u76ee\u5f55\u4e2d\u6dfb\u52a0\u4e86\u4e00\u4e9b\u542b\u6709\u654f\u611f\u4fe1\u606f\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u6216\u8005\u662f\u4e00\u4e9b\u6ca1\u6709\u4f5c\u7528\u7684\u65e5\u5fd7\u6587\u4ef6\uff08\u4e2d\u95f4\u6587\u4ef6\uff09\u800c\u4e0d\u60f3\u63d0\u4ea4\uff0c\u5c31\u53ef\u4ee5\u5728 Git \u7684\u5de5\u4f5c\u76ee\u5f55\u6839\u76ee\u5f55\u4e0b \u7684 <code>.gitignore<\/code> \u6587\u4ef6\u4e2d\u6dfb\u52a0\u60f3\u8981\u5ffd\u7565\u6389\u7684\u6587\u4ef6\u540d\uff0c Git \u5c31\u4f1a\u5ffd\u7565\u6389\u5176\u4e2d\u7684\u6587\u4ef6\u3002<\/p>\n\n\n\n<p>\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#----------------#\n# \u5ffd\u7565\u6389 Windows \u751f\u6210\u7684\u7f29\u7565\u56fe\nThumbs.db\n\n# \u5ffd\u7565\u6389\u914d\u7f6e\u6587\u4ef6\n*.ini\n\n# \u5ffd\u7565\u6389\u4e2d\u95f4\u6587\u4ef6\u548c\u53ef\u6267\u884c\u6587\u4ef6\n*.log\n*.exe\n\n# \u5ffd\u7565\u6389\u6587\u4ef6\u5939\nwww\/logs\/\n#----------------#\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u63d0\u4ea4-gitignore-\u6587\u4ef6\">\u63d0\u4ea4 .gitignore \u6587\u4ef6<\/h2>\n\n\n\n<p>\u4f7f\u7528\u6307\u4ee4\u63d0\u4ea4 <code>git commit -m \"update .gitignore\"<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u68c0\u67e5\u6587\u4ef6\u662f\u5426\u88ab-git-\u5ffd\u7565\">\u68c0\u67e5\u6587\u4ef6\u662f\u5426\u88ab Git \u5ffd\u7565<\/h2>\n\n\n\n<p>\u4f7f\u7528 <code>git check-ignore -v &lt;\u6587\u4ef6\u8def\u5f84&gt;<\/code> \u547d\u4ee4\u68c0\u67e5\u662f\u5426\u6b63\u786e\u5ffd\u7565\u4e86\u6587\u4ef6\u3002\n\u5982\u679c\u8f93\u51fa\u4e86 <code>.gitignore<\/code> \u4e2d\u7684\u89c4\u5219\u8def\u5f84 \u548c\u6240\u5728\u7684\u884c\u53f7\uff0c\u5219\u6587\u4ef6\u88ab\u5ffd\u7565\u3002<\/p>\n\n\n\n<p>\u540c\u65f6\u53ef\u4ee5\u914d\u5408 <code>git status<\/code> \u6307\u4ee4\u6765\u68c0\u67e5\u6587\u4ef6\u662f\u5426\u5b58\u5728 Untracked Files \u7684\u90e8\u5206\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"\u505c\u6b62-git-\u8ddf\u8e2a\u5148\u524d\u63d0\u4ea4\u8fc7\u7684\u6587\u4ef6\">\u505c\u6b62 Git \u8ddf\u8e2a\u5148\u524d\u63d0\u4ea4\u8fc7\u7684\u6587\u4ef6<\/h1>\n\n\n\n<p>\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u4f1a\u53d1\u73b0\u4e0d\u60f3\u88ab\u6dfb\u52a0\u7684\u6587\u4ef6\u5df2\u7ecf\u88ab\u6dfb\u52a0\u5e76\u63d0\u4ea4\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u6dfb\u52a0\u5230-gitignore-\u6587\u4ef6\u4e2d\">\u6dfb\u52a0\u5230 .gitignore \u6587\u4ef6\u4e2d<\/h2>\n\n\n\n<p>\u5c06\u60f3\u8981\u4e0d\u518d\u8ddf\u8e2a\u7684\u6587\u4ef6\u6216\u8005\u6587\u4ef6\u5939\u6dfb\u52a0\u5230 <code>.gitignore<\/code> \u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># .gitignore \u6587\u4ef6\n# \u4f1a\u5ffd\u7565 itignore \u6587\u4ef6\u6240\u5728\u76ee\u5f55\u7684\n# logs\u6587\u4ef6\u5939\nlogs\/\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u4ece-git-\u7d22\u5f15\u4e2d\u79fb\u9664\">\u4ece Git \u7d22\u5f15\u4e2d\u79fb\u9664<\/h2>\n\n\n\n<p>\u60f3\u8981 Git \u4e0d\u518d\u8ddf\u8e2a\u8fd9\u4e9b\u6587\u4ef6\uff0c\u6b64\u65f6\u53ea\u662f\u5355\u7eaf\u6dfb\u52a0\u5230 <code>.gitignore<\/code> \u6587\u4ef6\u4e2d\u5e76\u4e0d\u80fd\u8ba9 Git \u505c\u6b62\u8ddf\u8e2a\u8fd9\u4e9b\u6587\u4ef6\u3002\u9700\u8981\u4f7f\u7528 <code>Git rm --cached<\/code> \u547d\u4ee4\u6765\u4ece Git \u7684\u7d22\u5f15\u4e2d\u79fb\u9664\u4ed6\u4eec\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u79fb\u9664logs\u6587\u4ef6\u5939\u4e0b\u7684\u6240\u6709\u6587\u4ef6\ngit rm \u2014\u2014cached logs -r\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u63d0\u4ea4\u66f4\u6539\">\u63d0\u4ea4\u66f4\u6539<\/h2>\n\n\n\n<p>\u5728\u505c\u6b62\u8ddf\u8e2a\u6587\u4ef6\u540e\uff0c\u63d0\u4ea4\u8fd9\u4e9b\u66f4\u6539<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git commit -m \"Stop tracking logs package\"\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u63a8\u9001\u66f4\u6539\">\u63a8\u9001\u66f4\u6539<\/h2>\n\n\n\n<p>\u5982\u679c\u5e0c\u671b\u5c06\u63d0\u4ea4\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\n\u4f7f\u7528 <code>git push<\/code> \u547d\u4ee4\u63a8\u9001\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5ffd\u89c6\u9879\u76ee\u4e2d\u7684 .gitignore \u4f1a\u7559\u4e0b\u9690\u60a3\u3002 \u5728.gitignore\u4e2d\u6dfb\u52a0\u914d\u7f6e \u5982\u679c\u5728 Git \u7684\u5de5\u4f5c\u76ee\u5f55 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[20,17],"tags":[],"class_list":["post-546","post","type-post","status-publish","format-standard","hentry","category-git","category-17"],"_links":{"self":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts\/546","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/comments?post=546"}],"version-history":[{"count":1,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts\/546\/revisions"}],"predecessor-version":[{"id":547,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts\/546\/revisions\/547"}],"wp:attachment":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/media?parent=546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/categories?post=546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/tags?post=546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}