{"id":2575,"date":"2025-03-31T22:49:16","date_gmt":"2025-03-31T14:49:16","guid":{"rendered":"https:\/\/tobykskgd.life\/?p=2575"},"modified":"2025-03-31T22:49:18","modified_gmt":"2025-03-31T14:49:18","slug":"108","status":"publish","type":"post","link":"https:\/\/tobykskgd.life\/index.php\/108\/","title":{"rendered":"\u4f7f\u7528 Git \u7ba1\u7406 Unity \u9879\u76ee\u82e5\u5e72\u95ee\u9898"},"content":{"rendered":"\n<p>\u5982\u679c\u4f60\u60f3\u4f7f\u7528 Git \u7ba1\u7406 Unity \u9879\u76ee\uff0c\u4f60\u53ef\u80fd\u4f1a\u9047\u5230\u7684\u51e0\u4e2a\u95ee\u9898\uff0c\u4eca\u5929\u90fd\u9047\u5230\u4e86\u5e76\u5728 GPT \u8001\u5e08\u7684\u5e2e\u52a9\u4e0b\u6210\u529f\u89e3\u51b3\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Windows \u7684\u6362\u884c\u7b26\u95ee\u9898<\/h2>\n\n\n\n<p>\u5f53\u4f60\u63d0\u4ea4 Git \u7684\u65f6\u5019\u4e5f\u8bb8\u4f1a\u9047\u5230\u4e0b\u9762\u8fd9\u79cd\u60c5\u51b5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git add .<br>warning: in the working copy of 'README.md', CRLF will be replaced by LF the next time Git touches it<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a <strong>CRLF<\/strong> \u8b66\u544a\u662f\u56e0\u4e3a\u6709\u4e9b\u6587\u4ef6\u4f7f\u7528\u4e86 Windows \u98ce\u683c\u7684\u6362\u884c\u7b26\uff08CRLF\uff09\uff0c\u800c Git \u9884\u8ba1\u4f7f\u7528 Unix \u98ce\u683c\u7684\u6362\u884c\u7b26\uff08LF\uff09\u3002\u5982\u679c\u4f60\u6b63\u5728\u5199 Markdown \u6587\u4ef6\uff0c\u63a8\u8350\u4f60\u5728 Typora \u8f6f\u4ef6\u7684\u504f\u597d\u8bbe\u7f6e\u4e2d\u627e\u5230\u9ed8\u8ba4\u6362\u884c\u7b26\uff0c\u6539\u6210 LF \u4e5f\u5c31\u662f Unix \u7684\u98ce\u683c\u3002<\/p>\n\n\n\n<p>\u5728\u4e00\u5f00\u59cb\u521d\u59cb\u5316\u4ed3\u5e93\u65f6\uff0c\u4f60\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u547d\u4ee4\u8fdb\u884c\u5168\u5c40\u7684\u7edf\u4e00\u8bbe\u7f6e\uff0c\u8fd9\u6837 Windows \u7aef\u5c31\u53ef\u4ee5\u548c Unix\/Linux \u6216\u8005 MacOS \u7aef\u540c\u6b65\u5f00\u53d1\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git config --global core.eol lf<br>git config --global core.autocrlf input<\/code><\/pre>\n\n\n\n<p>\u5f53\u7136\uff0c\u5982\u679c\u4f60\u5728\u770b\u8fd9\u7bc7\u6587\u6863\u4e4b\u524d\u5c31\u521b\u5efa\u5e76\u5199\u4e86\u5982 README.md \u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u8bd5\u8bd5\u4e0b\u9762\u8fd9\u4e32\u547d\u4ee4\u8fdb\u884c\u4fee\u6539\uff1a<br>\u9996\u5148\u81ea\u52a8\u4fee\u6b63\u6362\u884c\u7b26\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git config --global core.autocrlf true<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u91cd\u65b0\u6dfb\u52a0\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git rm --cached README.md<br>git add README.md<\/code><\/pre>\n\n\n\n<p>\u6700\u540e\u518d\u91cd\u65b0\u63d0\u4ea4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git commit -m \"Fixed CRLF issue in README.md\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Unity \u7684 Library \u76ee\u5f55\u4e0d\u8981\u4e0a\u4f20 Git<\/h2>\n\n\n\n<p>Unity \u9879\u76ee\u4e2d\u7684 Library \u76ee\u5f55\u4e0d\u5e94\u8be5\u63d0\u4ea4\u5230 Git\uff01<code>Library\/<\/code> \u76ee\u5f55\u662f Unity \u751f\u6210\u7684\u4e34\u65f6\u6587\u4ef6\uff0c\u5e94\u8be5\u52a0\u5165 <code>.gitignore<\/code>\uff0c\u5426\u5219 Git \u53ef\u80fd\u4f1a\u9519\u8bef\u5730\u8ddf\u8e2a\u8fd9\u4e9b\u4e34\u65f6\u6587\u4ef6\u7684\u53d8\u66f4\u3002<\/p>\n\n\n\n<p>\u5e94\u8be5 <strong>\u628a Unity \u751f\u6210\u7684 Library \u76ee\u5f55\u4ece Git \u4e2d\u6392\u9664<\/strong>\uff0c\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p><strong>\u521b\u5efa\u6216\u4fee\u6539 <code>.gitignore<\/code> \u6587\u4ef6<\/strong>\uff08\u5982\u679c\u6ca1\u6709\u8fd9\u4e2a\u6587\u4ef6\uff0c\u53ef\u4ee5\u65b0\u5efa\uff09 \u5728 <code>.gitignore<\/code> \u4e2d\u6dfb\u52a0\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>Library\/<br>Temp\/<br>Logs\/<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u4f60\u6ca1\u6709\u9690\u85cf\u6587\u4ef6 .gitignore\uff0c\u53ef\u4ee5\u6309\u7167\u4e0b\u9762\u7684\u6b65\u9aa4\u521b\u5efa\uff1a<\/p>\n\n\n\n<p>\u53ef\u4ee5\u8fd0\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>touch .gitignore<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u6253\u5f00 <code>.gitignore<\/code> \u6587\u4ef6\u8fdb\u884c\u7f16\u8f91\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano .gitignore<\/code><\/pre>\n\n\n\n<p>\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Library\/<br>Temp\/<br>Logs\/<\/code><\/pre>\n\n\n\n<p>\u6309 <code>Ctrl + X<\/code> \u9000\u51fa\uff0c\u6309 <code>Y<\/code> \u4fdd\u5b58\u3002<\/p>\n\n\n\n<p>\u7ec8\u4e8e\u5f00\u59cb\u5b66\u4e60 Unity \u5f15\u64ce\uff0c\u76ee\u524d\u6253\u7b97\u770b\u51e0\u4e2a\u7b80\u5355\u7684\u6559\u7a0b\uff0c\u5b66\u505a\u51e0\u4e2a\u7b80\u5355\u7684\u6e38\u620f\u9879\u76ee\uff0c\u7136\u540e\u81ea\u5df1\u770b\u770b\u80fd\u4e0d\u80fd\u6413\u4e00\u4e2a\u7b80\u5355\u7684\u5c0f\u6e38\u620f\u7ec3\u4e60\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u4f60\u60f3\u4f7f\u7528 Git \u7ba1\u7406 Unity \u9879\u76ee\uff0c\u4f60\u53ef\u80fd\u4f1a\u9047\u5230\u7684\u51e0\u4e2a\u95ee\u9898\uff0c\u4eca\u5929\u90fd\u9047\u5230\u4e86\u5e76\u5728 GPT \u8001\u5e08\u7684\u5e2e\u52a9\u4e0b\u6210 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[48,32,37],"class_list":["post-2575","post","type-post","status-publish","format-standard","hentry","category-jc","tag-unity","tag-share","tag-jc"],"_links":{"self":[{"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/posts\/2575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/comments?post=2575"}],"version-history":[{"count":4,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/posts\/2575\/revisions"}],"predecessor-version":[{"id":2579,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/posts\/2575\/revisions\/2579"}],"wp:attachment":[{"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/media?parent=2575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/categories?post=2575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tobykskgd.life\/index.php\/wp-json\/wp\/v2\/tags?post=2575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}