{"id":150,"date":"2026-04-12T22:09:22","date_gmt":"2026-04-12T14:09:22","guid":{"rendered":"https:\/\/momozi.online\/?p=150"},"modified":"2026-04-12T22:16:24","modified_gmt":"2026-04-12T14:16:24","slug":"about-git","status":"publish","type":"post","link":"https:\/\/momozi.online\/index.php\/2026\/04\/12\/about-git\/","title":{"rendered":"Git \u4ed3\u5e93\u5efa\u7acb\u4e0e\u6587\u4ef6\u8fc7\u6ee4\u5b8c\u6574\u6307\u5357"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u672c\u6587\u6863\u8bb0\u5f55\u4e86\u5c06\u672c\u5730 Apollo_PnC \u5de5\u7a0b\u63a8\u9001\u5230 GitHub \u4ed3\u5e93\uff0c\u5e76\u901a\u8fc7 <code>.gitignore<\/code> \u5b9e\u73b0\u6587\u4ef6\u8fc7\u6ee4\u7684\u5b8c\u6574\u6d41\u7a0b\u3002<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udccb \u76ee\u5f55<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"#1-\u9879\u76ee\u80cc\u666f\u4e0e\u76ee\u6807\">\u9879\u76ee\u80cc\u666f\u4e0e\u76ee\u6807<\/a><\/li>\n\n\n\n<li><a href=\"#2-\u73af\u5883\u51c6\u5907\">\u73af\u5883\u51c6\u5907<\/a><\/li>\n\n\n\n<li><a href=\"#3-\u914d\u7f6e-gitignore\">\u914d\u7f6e .gitignore<\/a><\/li>\n\n\n\n<li><a href=\"#4-\u521d\u59cb\u5316\u4e0e\u914d\u7f6e\u4ed3\u5e93\">\u521d\u59cb\u5316\u4e0e\u914d\u7f6e\u4ed3\u5e93<\/a><\/li>\n\n\n\n<li><a href=\"#5-\u6e05\u7406\u5df2\u8ffd\u8e2a\u6587\u4ef6\">\u6e05\u7406\u5df2\u8ffd\u8e2a\u6587\u4ef6<\/a><\/li>\n\n\n\n<li><a href=\"#6-\u63a8\u9001\u81f3\u8fdc\u7a0b\u4ed3\u5e93\">\u63a8\u9001\u81f3\u8fdc\u7a0b\u4ed3\u5e93<\/a><\/li>\n\n\n\n<li><a href=\"#7-\u9a8c\u8bc1\u7ed3\u679c\">\u9a8c\u8bc1\u7ed3\u679c<\/a><\/li>\n\n\n\n<li><a href=\"#8-git-\u5e38\u7528\u6307\u4ee4\u5927\u5168\">Git \u5e38\u7528\u6307\u4ee4\u5927\u5168<\/a><\/li>\n\n\n\n<li><a href=\"#9-linux-\u5e38\u7528\u6307\u4ee4\">Linux \u5e38\u7528\u6307\u4ee4<\/a><\/li>\n\n\n\n<li><a href=\"#10-\u5e38\u89c1\u95ee\u9898\u4e0e\u89e3\u51b3\u65b9\u6848\">\u5e38\u89c1\u95ee\u9898\u4e0e\u89e3\u51b3\u65b9\u6848<\/a><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">1. \u9879\u76ee\u80cc\u666f\u4e0e\u76ee\u6807<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1.1 \u573a\u666f\u63cf\u8ff0<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u672c\u5730\u5de5\u7a0b<\/strong>: Apollo_PnC\uff08\u4f4d\u4e8e WSL \u73af\u5883\uff09<\/li>\n\n\n\n<li><strong>\u76ee\u6807\u4ed3\u5e93<\/strong>: https:\/\/github.com\/mo-fishkiller\/APOLLO_EDU_WORKSPACE<\/li>\n\n\n\n<li><strong>\u6838\u5fc3\u9700\u6c42<\/strong>: \u53ea\u4e0a\u4f20\u7279\u5b9a\u6587\u4ef6\uff08\u914d\u7f6e\u6587\u4ef6\u3001\u6587\u6863\uff09\uff0c\u8fc7\u6ee4\u6389\u6784\u5efa\u4ea7\u7269\u3001IDE\u914d\u7f6e\u3001\u4e34\u65f6\u6587\u4ef6\u7b49<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">1.2 \u6700\u7ec8\u6210\u679c<\/h3>\n\n\n\n<p>GitHub \u4ed3\u5e93\u53ea\u5305\u542b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\ud83d\udcc1 APOLLO_EDU_WORKSPACE\/\n\u251c\u2500\u2500 .gitignore\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 README_cn.md\n\u2514\u2500\u2500  profiles\/sample\/modules\/... (\u914d\u7f6e\u6587\u4ef6)\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. \u73af\u5883\u51c6\u5907<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">2.1 \u68c0\u67e5\u73af\u5883<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u786e\u8ba4 Git \u5df2\u5b89\u88c5\ngit --version\n\n# \u786e\u8ba4\u5f53\u524d\u76ee\u5f55\npwd\n\n# \u67e5\u770b\u672c\u5730\u6587\u4ef6\u7ed3\u6784\nls -la\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">2.2 \u521b\u5efa GitHub \u4ed3\u5e93<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u8bbf\u95ee GitHub: https:\/\/github.com<\/li>\n\n\n\n<li>\u70b9\u51fb\u53f3\u4e0a\u89d2 &#8220;+&#8221; \u2192 &#8220;New repository&#8221;<\/li>\n\n\n\n<li>\u586b\u5199\u4ed3\u5e93\u540d: <code>APOLLO_EDU_WORKSPACE<\/code><\/li>\n\n\n\n<li>\u9009\u62e9 <strong>Public<\/strong> \u6216 <strong>Private<\/strong><\/li>\n\n\n\n<li>\u26a0\ufe0f <strong>\u4e0d\u8981\u52fe\u9009<\/strong> &#8220;Initialize this repository with a README&#8221;\uff08\u4fdd\u6301\u7a7a\u767d\uff09<\/li>\n\n\n\n<li>\u70b9\u51fb &#8220;Create repository&#8221;<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u914d\u7f6e .gitignore<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">3.1 \u7f16\u5199 .gitignore \u89c4\u5219<\/h3>\n\n\n\n<p>\u521b\u5efa\u6216\u7f16\u8f91 <code>.gitignore<\/code> \u6587\u4ef6\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u4f7f\u7528\u7f16\u8f91\u5668\u6253\u5f00\nnano .gitignore\n# \u6216\nvim .gitignore\n<\/pre><\/div>\n\n\n<p>\u5199\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# ========== \u5ffd\u7565\u6240\u6709\u5185\u5bb9 ==========\n# \u5ffd\u7565\u6839\u76ee\u5f55\u4e0b\u6240\u6709\u6587\u4ef6\u548c\u6587\u4ef6\u5939\n\/*\n\/.*\n\n# ========== \u767d\u540d\u5355\uff1a\u4fdd\u7559\u6839\u76ee\u5f55\u7279\u5b9a\u6587\u4ef6 ==========\n!.gitignore\n!README.md\n!README_cn.md\n\n# ========== \u767d\u540d\u5355\uff1a\u4fdd\u7559\u7279\u5b9a\u76ee\u5f55\u53ca\u5176\u5168\u90e8\u5185\u5bb9 ==========\n# \u5148\u4fdd\u7559\u76ee\u5f55\u672c\u8eab\uff08\u5426\u5219\u65e0\u6cd5\u8fdb\u5165\u76ee\u5f55\uff09\n!\/modules\/\n!\/profiles\/\n# \u518d\u4fdd\u7559\u76ee\u5f55\u5185\u7684\u6240\u6709\u6587\u4ef6\u548c\u5b50\u76ee\u5f55\n!\/modules\/**\n!\/profiles\/**\n\n# ========== \u989d\u5916\u5ffd\u7565\uff08\u53ef\u9009\uff09 ==========\n# \u5ffd\u7565\u6240\u6709 .vscode \u76ee\u5f55\n**\/.vscode\/\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">3.2 \u89c4\u5219\u8bf4\u660e<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u89c4\u5219<\/th><th>\u4f5c\u7528<\/th><\/tr><\/thead><tbody><tr><td><code>\/*<\/code><\/td><td>\u5ffd\u7565\u6839\u76ee\u5f55\u4e0b\u6240\u6709\u6587\u4ef6\uff08\u975e\u9012\u5f52\uff09<\/td><\/tr><tr><td><code>\/.*<\/code><\/td><td>\u5ffd\u7565\u6839\u76ee\u5f55\u4e0b\u6240\u6709\u9690\u85cf\u6587\u4ef6<\/td><\/tr><tr><td><code>!.gitignore<\/code><\/td><td><strong>\u4f8b\u5916<\/strong>\uff1a\u4fdd\u7559 .gitignore \u6587\u4ef6<\/td><\/tr><tr><td><code>!\/modules\/<\/code><\/td><td><strong>\u4f8b\u5916<\/strong>\uff1a\u4fdd\u7559 modules \u76ee\u5f55\u672c\u8eab<\/td><\/tr><tr><td><code>!\/modules\/**<\/code><\/td><td><strong>\u4f8b\u5916<\/strong>\uff1a\u4fdd\u7559 modules \u76ee\u5f55\u4e0b\u6240\u6709\u5185\u5bb9<\/td><\/tr><tr><td><code>**\/.vscode\/<\/code><\/td><td>\u5ffd\u7565\u6240\u6709\u5c42\u7ea7\u7684 .vscode \u76ee\u5f55<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\ud83d\udca1 <strong>\u91cd\u8981<\/strong>: <code>!<\/code> \u5f00\u5934\u7684\u89c4\u5219\u5fc5\u987b\u5199\u5728\u5ffd\u7565\u89c4\u5219<strong>\u4e4b\u540e<\/strong>\uff0cGit \u6309\u987a\u5e8f\u5904\u7406\u89c4\u5219\u3002<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u521d\u59cb\u5316\u4e0e\u914d\u7f6e\u4ed3\u5e93<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">4.1 \u521d\u59cb\u5316 Git \u4ed3\u5e93<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u8fdb\u5165\u5de5\u7a0b\u76ee\u5f55\ncd \/home\/morobot\/application-pnc\n\n# \u521d\u59cb\u5316 Git\uff08\u5982\u679c\u5c1a\u672a\u521d\u59cb\u5316\uff09\ngit init\n\n# \u67e5\u770b\u5f53\u524d\u72b6\u6001\ngit status\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">4.2 \u914d\u7f6e\u8fdc\u7a0b\u4ed3\u5e93<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u73b0\u6709\u8fdc\u7a0b\u914d\u7f6e\ngit remote -v\n\n# \u5982\u679c origin \u4e0d\u5b58\u5728\uff0c\u6dfb\u52a0\u8fdc\u7a0b\u4ed3\u5e93\ngit remote add origin https:\/\/github.com\/mo-fishkiller\/APOLLO_EDU_WORKSPACE.git\n\n# \u5982\u679c origin \u5df2\u5b58\u5728\uff0c\u4fee\u6539 URL\ngit remote set-url origin https:\/\/github.com\/mo-fishkiller\/APOLLO_EDU_WORKSPACE.git\n\n# \u9a8c\u8bc1\u914d\u7f6e\ngit remote -v\n<\/pre><\/div>\n\n\n<p><strong>\u9884\u671f\u8f93\u51fa<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\norigin  https:\/\/github.com\/mo-fishkiller\/APOLLO_EDU_WORKSPACE.git (fetch)\norigin  https:\/\/github.com\/mo-fishkiller\/APOLLO_EDU_WORKSPACE.git (push)\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">4.3 \u9996\u6b21\u63d0\u4ea4 .gitignore<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u6dfb\u52a0 .gitignore \u5230\u6682\u5b58\u533a\ngit add .gitignore\n\n# \u63d0\u4ea4\ngit commit -m &quot;chore: add .gitignore with whitelist rules&quot;\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u6e05\u7406\u5df2\u8ffd\u8e2a\u6587\u4ef6<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">5.1 \u95ee\u9898\u8bca\u65ad<\/h3>\n\n\n\n<p><strong>\u5173\u952e\u95ee\u9898<\/strong>: <code>.gitignore<\/code> \u53ea\u5bf9<strong>\u672a\u8ffd\u8e2a<\/strong>\u7684\u6587\u4ef6\u751f\u6548\u3002\u5982\u679c\u6587\u4ef6\u4e4b\u524d\u5df2\u88ab <code>git add<\/code>\uff0c\u4fee\u6539 <code>.gitignore<\/code> \u4e0d\u4f1a\u81ea\u52a8\u79fb\u9664\u5b83\u4eec\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b Git \u5f53\u524d\u8ffd\u8e2a\u7684\u6240\u6709\u6587\u4ef6\ngit ls-files\n\n# \u67e5\u770b\u6700\u8fd1\u63d0\u4ea4\u6d89\u53ca\u7684\u6587\u4ef6\ngit diff-tree --no-commit-id --name-only -r HEAD~3..HEAD | sort | uniq\n<\/pre><\/div>\n\n\n<p><strong>\u5178\u578b\u8f93\u51fa<\/strong>\uff08\u5305\u542b\u4e0d\u9700\u8981\u7684\u6587\u4ef6\uff09:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.buildtool.conf.aarch64\n.buildtool.conf.x86_64\n.clang-format\n.editorconfig\n.env.aarch64\n.env.x86_64\n.vscode\/c_cpp_properties.json\n.vscode\/settings.json\n.workspace.json.aarch64\n.workspace.json.x86_64\nWORKSPACE\ncore\/BUILD\ncore\/cyberfile.xml\nkill_all.sh\nsetup.sh\n...\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">5.2 \u6e05\u9664 Git \u7f13\u5b58\uff08\u6838\u5fc3\u6b65\u9aa4\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u26a0\ufe0f \u5173\u952e\u547d\u4ee4\uff1a\u4ece Git \u7d22\u5f15\u79fb\u9664\u6240\u6709\u6587\u4ef6\uff08\u4e0d\u5220\u9664\u672c\u5730\u6587\u4ef6\uff01\uff09\ngit rm -r --cached .\n<\/pre><\/div>\n\n\n<p><strong>\u53c2\u6570\u8bf4\u660e<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>rm<\/code>: \u4ece\u4ed3\u5e93\u79fb\u9664\u6587\u4ef6<\/li>\n\n\n\n<li><code>-r<\/code>: \u9012\u5f52\u5904\u7406\u76ee\u5f55<\/li>\n\n\n\n<li><code>--cached<\/code>: <strong>\u53ea\u4ece Git \u7d22\u5f15\u79fb\u9664\uff0c\u4fdd\u7559\u672c\u5730\u78c1\u76d8\u6587\u4ef6<\/strong>\uff08\u5b89\u5168\uff01\uff09<\/li>\n\n\n\n<li><code>.<\/code>: \u5f53\u524d\u76ee\u5f55\u4e0b\u7684\u6240\u6709\u6587\u4ef6<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">5.3 \u91cd\u65b0\u6dfb\u52a0\u6587\u4ef6<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u91cd\u65b0\u6dfb\u52a0\u6587\u4ef6\uff08\u6b64\u65f6 .gitignore \u89c4\u5219\u751f\u6548\uff09\ngit add .\n\n# \u67e5\u770b\u6682\u5b58\u533a\u72b6\u6001\ngit status\n<\/pre><\/div>\n\n\n<p><strong>\u9884\u671f\u8f93\u51fa<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nOn branch main\nChanges to be committed:\n  (use &quot;git restore --staged &amp;lt;file&gt;...&quot; to unstage)\n        deleted:    .buildtool.conf.aarch64\n        deleted:    .clang-format\n        deleted:    WORKSPACE\n        deleted:    core\/BUILD\n        ...\n        modified:   .gitignore\n        new file:   profiles\/sample\/modules\/...\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">5.4 \u9a8c\u8bc1\u8fc7\u6ee4\u7ed3\u679c<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u5f53\u524d\u6682\u5b58\u533a\u7684\u6587\u4ef6\ngit diff --cached --name-only\n\n# \u6216\u67e5\u770b Git \u8ffd\u8e2a\u7684\u6587\u4ef6\ngit ls-files\n<\/pre><\/div>\n\n\n<p><strong>\u9884\u671f\u7ed3\u679c<\/strong>\uff08\u53ea\u4fdd\u7559\u767d\u540d\u5355\u6587\u4ef6\uff09:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.gitignore\nREADME.md\nREADME_cn.md\nprofiles\/sample\/modules\/canbus\/conf\/canbus.conf\nprofiles\/sample\/modules\/canbus\/conf\/canbus_conf.pb.txt\nprofiles\/sample\/modules\/common\/data\/vehicle_param.pb.txt\n...\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">5.5 \u63d0\u4ea4\u6e05\u7406\u7ed3\u679c<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u63d0\u4ea4\u8fc7\u6ee4\u540e\u7684\u6587\u4ef6\u7ed3\u6784\ngit commit -m &quot;chore: apply .gitignore filter, untrack build\/IDE\/config files&quot;\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">6. \u63a8\u9001\u81f3\u8fdc\u7a0b\u4ed3\u5e93<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">6.1 \u8bbe\u7f6e\u4e3b\u5206\u652f<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u786e\u4fdd\u5206\u652f\u540d\u4e3a main\uff08GitHub \u9ed8\u8ba4\uff09\ngit branch -M main\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">6.2 \u63a8\u9001\u5230 GitHub<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u9996\u6b21\u63a8\u9001\u5e76\u8bbe\u7f6e\u4e0a\u6e38\u5206\u652f\ngit push -u origin main\n<\/pre><\/div>\n\n\n<p><strong>\u53c2\u6570\u8bf4\u660e<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-u<\/code>: \u8bbe\u7f6e upstream\uff08\u4e0a\u6e38\u5206\u652f\uff09\uff0c\u540e\u7eed\u53ef\u76f4\u63a5\u4f7f\u7528 <code>git push<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">6.3 \u8ba4\u8bc1\u65b9\u5f0f<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">\u65b9\u5f0f A: HTTPS + Token\uff08\u63a8\u8350\u4e34\u65f6\u4f7f\u7528\uff09<\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u63a8\u9001\u65f6\u4f1a\u63d0\u793a\uff1a\nUsername for 'https:\/\/github.com': mo-fishkiller\nPassword for 'https:\/\/mo-fishkiller@github.com': \n\n# \u26a0\ufe0f \u5bc6\u7801\u5904\u8f93\u5165 GitHub Personal Access Token\uff08\u4e0d\u662f\u767b\u5f55\u5bc6\u7801\uff01\uff09\n# \u751f\u6210 Token: https:\/\/github.com\/settings\/tokens\n<\/pre><\/div>\n\n\n<h4 class=\"wp-block-heading\">\u65b9\u5f0f B: SSH\uff08\u63a8\u8350\u957f\u671f\u4f7f\u7528\uff09<\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# 1. \u4fee\u6539\u8fdc\u7a0b URL \u4e3a SSH\ngit remote set-url origin git@github.com:mo-fishkiller\/APOLLO_EDU_WORKSPACE.git\n\n# 2. \u751f\u6210 SSH \u5bc6\u94a5\uff08\u5982\u679c\u5c1a\u672a\u751f\u6210\uff09\nssh-keygen -t ed25519 -C &quot;your_email@example.com&quot;\n\n# 3. \u67e5\u770b\u516c\u94a5\ncat ~\/.ssh\/id_ed25519.pub\n\n# 4. \u5c06\u516c\u94a5\u6dfb\u52a0\u5230 GitHub\n# \ud83d\udc49 https:\/\/github.com\/settings\/keys\n\n# 5. \u6d4b\u8bd5\u8fde\u63a5\nssh -T git@github.com\n\n# 6. \u518d\u6b21\u63a8\u9001\ngit push -u origin main\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">6.4 \u540e\u7eed\u63a8\u9001<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u8bbe\u7f6e\u4e0a\u6e38\u5206\u652f\u540e\uff0c\u540e\u7eed\u53ea\u9700\uff1a\ngit add .\ngit commit -m &quot;feat: add new feature&quot;\ngit push\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">7. \u9a8c\u8bc1\u7ed3\u679c<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">7.1 \u547d\u4ee4\u884c\u9a8c\u8bc1<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6587\u4ef6\u6811\ngit ls-tree -r --name-only origin\/main\n\n# \u67e5\u770b\u8fdc\u7a0b\u5206\u652f\u4fe1\u606f\ngit branch -r\n\n# \u67e5\u770b\u8fdc\u7a0b\u4ed3\u5e93 URL\ngit remote -v\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">7.2 GitHub \u7f51\u9875\u9a8c\u8bc1<\/h3>\n\n\n\n<p>\u8bbf\u95ee\u4ed3\u5e93\u9875\u9762\uff1a<br>\ud83d\udc49 https:\/\/github.com\/mo-fishkiller\/APOLLO_EDU_WORKSPACE<\/p>\n\n\n\n<p><strong>\u68c0\u67e5\u9879<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 \u53ea\u5305\u542b <code>.gitignore<\/code>, <code>README*.md<\/code>, <code>profiles\/<\/code> \u7b49\u767d\u540d\u5355\u6587\u4ef6<\/li>\n\n\n\n<li>\u2705 \u6ca1\u6709 <code>.vscode\/<\/code>, <code>build\/<\/code>, <code>WORKSPACE<\/code>, <code>.env.*<\/code> \u7b49\u6587\u4ef6<\/li>\n\n\n\n<li>\u2705 \u63d0\u4ea4\u5386\u53f2\u663e\u793a\u6700\u65b0\u7684\u8fc7\u6ee4\u63d0\u4ea4<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">7.3 \u672c\u5730\u72b6\u6001\u68c0\u67e5<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u786e\u8ba4\u5de5\u4f5c\u533a\u5e72\u51c0\ngit status\n\n# \u9884\u671f\u8f93\u51fa\uff1a\n# On branch main\n# Your branch is up to date with 'origin\/main'.\n# nothing to commit, working tree clean\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">8. Git \u5e38\u7528\u6307\u4ee4\u5927\u5168<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">8.1 \u4ed3\u5e93\u521d\u59cb\u5316\u4e0e\u914d\u7f6e<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u521d\u59cb\u5316\u65b0\u4ed3\u5e93\ngit init\n\n# \u514b\u9686\u8fdc\u7a0b\u4ed3\u5e93\ngit clone &amp;lt;url&gt;\ngit clone &amp;lt;url&gt; &amp;lt;directory-name&gt;\n\n# \u67e5\u770b\u8fdc\u7a0b\u4ed3\u5e93\ngit remote -v\n\n# \u6dfb\u52a0\u8fdc\u7a0b\u4ed3\u5e93\ngit remote add origin &amp;lt;url&gt;\n\n# \u4fee\u6539\u8fdc\u7a0b\u4ed3\u5e93 URL\ngit remote set-url origin &amp;lt;new-url&gt;\n\n# \u5220\u9664\u8fdc\u7a0b\u4ed3\u5e93\ngit remote remove origin\n\n# \u67e5\u770b\u8fdc\u7a0b\u4ed3\u5e93\u8be6\u7ec6\u4fe1\u606f\ngit remote show origin\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">8.2 \u6587\u4ef6\u72b6\u6001\u4e0e\u67e5\u770b<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u4ed3\u5e93\u72b6\u6001\ngit status\ngit status -s          # \u7b80\u6d01\u683c\u5f0f\n\n# \u67e5\u770b\u5f53\u524d\u5206\u652f\ngit branch\ngit branch -a          # \u67e5\u770b\u6240\u6709\u5206\u652f\uff08\u5305\u62ec\u8fdc\u7a0b\uff09\ngit branch -r          # \u53ea\u770b\u8fdc\u7a0b\u5206\u652f\n\n# \u67e5\u770b\u63d0\u4ea4\u5386\u53f2\ngit log\ngit log --oneline      # \u7b80\u6d01\u683c\u5f0f\ngit log --oneline -10  # \u6700\u8fd110\u6761\ngit log --graph        # \u56fe\u5f62\u5316\u663e\u793a\n\n# \u67e5\u770b Git \u8ffd\u8e2a\u7684\u6587\u4ef6\ngit ls-files\ngit ls-files -s        # \u663e\u793a\u8be6\u7ec6\u4fe1\u606f\n\n# \u67e5\u770b\u88ab\u5ffd\u7565\u7684\u6587\u4ef6\ngit ls-files -o --ignored --exclude-standard\n\n# \u67e5\u770b\u6587\u4ef6\u5dee\u5f02\ngit diff               # \u5de5\u4f5c\u533a vs \u6682\u5b58\u533a\ngit diff --cached      # \u6682\u5b58\u533a vs HEAD\ngit diff HEAD~1        # \u5f53\u524d vs \u4e0a\u4e00\u6b21\u63d0\u4ea4\n\n# \u67e5\u770b\u67d0\u6b21\u63d0\u4ea4\u7684\u6587\u4ef6\ngit show --stat &amp;lt;commit-hash&gt;\ngit diff-tree --no-commit-id --name-only -r &amp;lt;commit-hash&gt;\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">8.3 \u6682\u5b58\u4e0e\u63d0\u4ea4<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u6dfb\u52a0\u6587\u4ef6\u5230\u6682\u5b58\u533a\ngit add &amp;lt;file&gt;\ngit add .              # \u6dfb\u52a0\u6240\u6709\u6587\u4ef6\ngit add -A             # \u6dfb\u52a0\u6240\u6709\u53d8\u66f4\uff08\u5305\u62ec\u5220\u9664\uff09\ngit add -u             # \u53ea\u6dfb\u52a0\u5df2\u8ffd\u8e2a\u7684\u6587\u4ef6\n\n# \u9884\u89c8 add \u6548\u679c\ngit add --dry-run .\n\n# \u4ece\u6682\u5b58\u533a\u79fb\u9664\ngit restore --staged &amp;lt;file&gt;\ngit reset HEAD &amp;lt;file&gt;  # \u65e7\u7248\u672c\u8bed\u6cd5\n\n# \u63d0\u4ea4\ngit commit -m &quot;\u63d0\u4ea4\u4fe1\u606f&quot;\ngit commit -am &quot;\u4fe1\u606f&quot;  # \u6dfb\u52a0\u5e76\u63d0\u4ea4\u5df2\u8ffd\u8e2a\u7684\u6587\u4ef6\n\n# \u4fee\u6539\u4e0a\u4e00\u6b21\u63d0\u4ea4\ngit commit --amend -m &quot;\u65b0\u7684\u63d0\u4ea4\u4fe1\u606f&quot;\ngit commit --amend --no-edit  # \u4e0d\u4fee\u6539\u4fe1\u606f\uff0c\u53ea\u6dfb\u52a0\u6587\u4ef6\n\n# \u64a4\u9500\u63d0\u4ea4\uff08\u4fdd\u7559\u4fee\u6539\uff09\ngit reset HEAD~1\ngit reset --soft HEAD~1\n\n# \u5f7b\u5e95\u64a4\u9500\u63d0\u4ea4\uff08\u5220\u9664\u4fee\u6539\uff09\ngit reset --hard HEAD~1\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">8.4 .gitignore \u76f8\u5173<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u6e05\u9664 Git \u7f13\u5b58\uff08\u4ece\u7d22\u5f15\u79fb\u9664\uff0c\u4fdd\u7559\u672c\u5730\u6587\u4ef6\uff09\ngit rm -r --cached .\ngit rm --cached &amp;lt;file&gt;\n\n# \u91cd\u65b0\u5e94\u7528 .gitignore \u89c4\u5219\ngit rm -r --cached . &amp;amp;&amp;amp; git add .\n\n# \u68c0\u67e5\u6587\u4ef6\u4e3a\u4f55\u88ab\u5ffd\u7565\ngit check-ignore -v &amp;lt;file&gt;\ngit check-ignore -v *.log\n\n# \u67e5\u770b .gitignore \u89c4\u5219\u5339\u914d\ngit check-ignore -v -n &amp;lt;file&gt;\n\n# \u5f3a\u5236\u6dfb\u52a0\u88ab\u5ffd\u7565\u7684\u6587\u4ef6\ngit add -f &amp;lt;file&gt;\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">8.5 \u5206\u652f\u7ba1\u7406<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u521b\u5efa\u5206\u652f\ngit branch &amp;lt;branch-name&gt;\n\n# \u5207\u6362\u5206\u652f\ngit checkout &amp;lt;branch-name&gt;\ngit switch &amp;lt;branch-name&gt;  # Git 2.23+\n\n# \u521b\u5efa\u5e76\u5207\u6362\u5206\u652f\ngit checkout -b &amp;lt;branch-name&gt;\ngit switch -c &amp;lt;branch-name&gt;\n\n# \u91cd\u547d\u540d\u5206\u652f\ngit branch -m &amp;lt;new-name&gt;\n\n# \u5220\u9664\u5206\u652f\ngit branch -d &amp;lt;branch-name&gt;       # \u5b89\u5168\u5220\u9664\ngit branch -D &amp;lt;branch-name&gt;       # \u5f3a\u5236\u5220\u9664\n\n# \u5408\u5e76\u5206\u652f\ngit merge &amp;lt;branch-name&gt;\n\n# \u67e5\u770b\u5206\u652f\u5408\u5e76\u60c5\u51b5\ngit branch --merged\ngit branch --no-merged\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">8.6 \u8fdc\u7a0b\u64cd\u4f5c<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u63a8\u9001\ngit push origin &amp;lt;branch&gt;\ngit push -u origin main    # \u9996\u6b21\u63a8\u9001\u5e76\u8bbe\u7f6e\u4e0a\u6e38\ngit push --all origin      # \u63a8\u9001\u6240\u6709\u5206\u652f\ngit push --tags            # \u63a8\u9001\u6807\u7b7e\n\n# \u5f3a\u5236\u63a8\u9001\uff08\u26a0\ufe0f \u8c28\u614e\u4f7f\u7528\uff09\ngit push -f origin main\ngit push --force-with-lease origin main  # \u66f4\u5b89\u5168\u7684\u5f3a\u5236\u63a8\u9001\n\n# \u62c9\u53d6\ngit pull origin main\ngit pull --rebase origin main  # \u53d8\u65b9\u5f0f\u62c9\u53d6\n\n# \u83b7\u53d6\u8fdc\u7a0b\u66f4\u65b0\uff08\u4e0d\u5408\u5e76\uff09\ngit fetch origin\ngit fetch --all\n\n# \u67e5\u770b\u8fdc\u7a0b\u5206\u652f\ngit branch -r\ngit branch -a\n\n# \u8ffd\u8e2a\u8fdc\u7a0b\u5206\u652f\ngit checkout -b &amp;lt;local-branch&gt; origin\/&amp;lt;remote-branch&gt;\ngit branch --set-upstream-to=origin\/&amp;lt;branch&gt; &amp;lt;branch&gt;\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">8.7 \u6807\u7b7e\u7ba1\u7406<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u6807\u7b7e\ngit tag\ngit tag -l &quot;v1.*&quot;\n\n# \u521b\u5efa\u6807\u7b7e\ngit tag v1.0.0\ngit tag -a v1.0.0 -m &quot;\u7248\u672c 1.0.0&quot;  # \u9644\u6ce8\u6807\u7b7e\n\n# \u63a8\u9001\u6807\u7b7e\ngit push origin v1.0.0\ngit push origin --tags\n\n# \u5220\u9664\u6807\u7b7e\ngit tag -d v1.0.0\ngit push origin --delete v1.0.0\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">8.8 \u64a4\u9500\u4e0e\u6062\u590d<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u4e22\u5f03\u5de5\u4f5c\u533a\u4fee\u6539\ngit restore &amp;lt;file&gt;\ngit restore .            # \u4e22\u5f03\u6240\u6709\u4fee\u6539\ngit checkout -- &amp;lt;file&gt;   # \u65e7\u7248\u672c\u8bed\u6cd5\n\n# \u64a4\u9500\u6682\u5b58\ngit restore --staged &amp;lt;file&gt;\ngit reset HEAD &amp;lt;file&gt;\n\n# \u64a4\u9500\u63d0\u4ea4\ngit reset HEAD~1         # \u4fdd\u7559\u4fee\u6539\ngit reset --hard HEAD~1  # \u5220\u9664\u4fee\u6539\n\n# \u6062\u590d\u5220\u9664\u7684\u6587\u4ef6\ngit checkout &amp;lt;commit-hash&gt; -- &amp;lt;file&gt;\n\n# \u67e5\u770b\u64cd\u4f5c\u5386\u53f2\ngit reflog\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">8.9 \u6e05\u7406\u4e0e\u7ef4\u62a4<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u6e05\u7406\u672a\u8ffd\u8e2a\u7684\u6587\u4ef6\ngit clean -n             # \u9884\u89c8\ngit clean -f             # \u6267\u884c\ngit clean -fd            # \u5305\u62ec\u76ee\u5f55\ngit clean -fdx           # \u5305\u62ec\u5ffd\u7565\u7684\u6587\u4ef6\n\n# \u5783\u573e\u56de\u6536\ngit gc\ngit gc --prune=now\n\n# \u67e5\u770b\u4ed3\u5e93\u5927\u5c0f\ngit count-objects -vH\n\n# \u4fee\u526a\u8fdc\u7a0b\u5206\u652f\ngit fetch --prune\ngit remote prune origin\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">8.10 \u9ad8\u7ea7\u64cd\u4f5c<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u53d8\u57fa\ngit rebase &amp;lt;branch&gt;\ngit rebase -i HEAD~3     # \u4ea4\u4e92\u5f0f\u53d8\u57fa\n\n# \u6682\u5b58\u66f4\u6539\ngit stash\ngit stash list\ngit stash pop\ngit stash apply\ngit stash drop\n\n# \u62e3\u9009\u63d0\u4ea4\ngit cherry-pick &amp;lt;commit-hash&gt;\n\n# \u4e8c\u5206\u67e5\u627e bug\ngit bisect start\ngit bisect bad\ngit bisect good &amp;lt;commit-hash&gt;\ngit bisect reset\n\n# \u67e5\u770b\u8c01\u4fee\u6539\u4e86\u4ee3\u7801\ngit blame &amp;lt;file&gt;\ngit log -p &amp;lt;file&gt;\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">8.11 \u914d\u7f6e\u4e0e\u522b\u540d<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u914d\u7f6e\ngit config --list\ngit config --global --list\n\n# \u8bbe\u7f6e\u914d\u7f6e\ngit config --global user.name &quot;Your Name&quot;\ngit config --global user.email &quot;your@email.com&quot;\ngit config --global core.editor &quot;vim&quot;\ngit config --global init.defaultBranch main\n\n# \u521b\u5efa\u522b\u540d\ngit config --global alias.co checkout\ngit config --global alias.br branch\ngit config --global alias.ci commit\ngit config --global alias.st status\ngit config --global alias.unstage &quot;reset HEAD --&quot;\ngit config --global alias.last &quot;log -1 HEAD&quot;\n\n# \u4f7f\u7528\u522b\u540d\ngit st      # \u7b49\u540c\u4e8e git status\ngit co -b feature  # \u7b49\u540c\u4e8e git checkout -b feature\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">9. Linux \u5e38\u7528\u6307\u4ee4<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">9.1 \u6587\u4ef6\u4e0e\u76ee\u5f55\u64cd\u4f5c<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u5f53\u524d\u76ee\u5f55\npwd\n\n# \u5217\u51fa\u6587\u4ef6\nls\nls -l           # \u8be6\u7ec6\u4fe1\u606f\nls -a           # \u663e\u793a\u9690\u85cf\u6587\u4ef6\nls -la          # \u7ec4\u5408\nls -lh          # \u4eba\u7c7b\u53ef\u8bfb\u5927\u5c0f\nls -t           # \u6309\u65f6\u95f4\u6392\u5e8f\nls -S           # \u6309\u5927\u5c0f\u6392\u5e8f\n\n# \u5207\u6362\u76ee\u5f55\ncd \/path\/to\/dir\ncd ..           # \u8fd4\u56de\u4e0a\u7ea7\ncd ~            # \u8fd4\u56de\u5bb6\u76ee\u5f55\ncd -            # \u8fd4\u56de\u4e0a\u4e00\u4e2a\u76ee\u5f55\ncd $OLDPWD      # \u540c\u4e0a\n\n# \u521b\u5efa\u76ee\u5f55\nmkdir dirname\nmkdir -p a\/b\/c  # \u9012\u5f52\u521b\u5efa\nmkdir dir1 dir2 # \u521b\u5efa\u591a\u4e2a\n\n# \u521b\u5efa\u6587\u4ef6\ntouch filename\necho &quot;content&quot; &gt; filename\necho &quot;line1&quot; &gt;&gt; filename  # \u8ffd\u52a0\n\n# \u590d\u5236\ncp file1 file2\ncp -r dir1 dir2      # \u9012\u5f52\u590d\u5236\u76ee\u5f55\ncp -i file1 file2    # \u8986\u76d6\u524d\u63d0\u793a\ncp -u file1 file2    # \u53ea\u590d\u5236\u66f4\u65b0\u7684\n\n# \u79fb\u52a8\/\u91cd\u547d\u540d\nmv oldname newname\nmv file \/path\/to\/dir\nmv -i file1 file2    # \u8986\u76d6\u524d\u63d0\u793a\n\n# \u5220\u9664\nrm file\nrm -r dirname        # \u9012\u5f52\u5220\u9664\u76ee\u5f55\nrm -f file           # \u5f3a\u5236\u5220\u9664\nrm -rf dirname       # \u26a0\ufe0f \u5f3a\u5236\u9012\u5f52\u5220\u9664\uff08\u5371\u9669\uff01\uff09\nrm -i file           # \u5220\u9664\u524d\u63d0\u793a\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">9.2 \u6587\u4ef6\u67e5\u770b\u4e0e\u7f16\u8f91<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u6587\u4ef6\u5185\u5bb9\ncat filename\nless filename        # \u5206\u9875\u67e5\u770b\uff08\u6309 q \u9000\u51fa\uff09\nmore filename        # \u5206\u9875\u67e5\u770b\nhead filename\nhead -n 20 filename  # \u524d20\u884c\ntail filename\ntail -f logfile      # \u5b9e\u65f6\u67e5\u770b\uff08Ctrl+C \u9000\u51fa\uff09\ntail -n 50 logfile   # \u540e50\u884c\n\n# \u6587\u672c\u7f16\u8f91\u5668\nnano filename        # \u7b80\u5355\u7f16\u8f91\u5668\nvim filename         # \u9ad8\u7ea7\u7f16\u8f91\u5668\nvi filename          # vi \u7f16\u8f91\u5668\ncode filename        # VS Code\n\n# Vim \u57fa\u7840\u547d\u4ee4\n# i - \u8fdb\u5165\u63d2\u5165\u6a21\u5f0f\n# Esc - \u9000\u51fa\u63d2\u5165\u6a21\u5f0f\n# :w - \u4fdd\u5b58\n# :q - \u9000\u51fa\n# :wq - \u4fdd\u5b58\u5e76\u9000\u51fa\n# :q! - \u5f3a\u5236\u9000\u51fa\u4e0d\u4fdd\u5b58\n# \/keyword - \u641c\u7d22\n# n - \u4e0b\u4e00\u4e2a\u5339\u914d\n# dd - \u5220\u9664\u4e00\u884c\n# yy - \u590d\u5236\u4e00\u884c\n# p - \u7c98\u8d34\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">9.3 \u6587\u4ef6\u641c\u7d22<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u627e\u6587\u4ef6\nfind \/path -name &quot;filename&quot;\nfind . -name &quot;*.py&quot;           # \u67e5\u627e Python \u6587\u4ef6\nfind . -type f -name &quot;*.txt&quot;  # \u53ea\u67e5\u627e\u6587\u4ef6\nfind . -type d -name &quot;build&quot;  # \u53ea\u67e5\u627e\u76ee\u5f55\nfind . -size +100M            # \u5927\u4e8e 100M\nfind . -mtime -7              # 7\u5929\u5185\u4fee\u6539\u8fc7\n\n# \u67e5\u627e\u5185\u5bb9\ngrep &quot;keyword&quot; filename\ngrep -r &quot;keyword&quot; .           # \u9012\u5f52\u641c\u7d22\ngrep -i &quot;keyword&quot; file        # \u5ffd\u7565\u5927\u5c0f\u5199\ngrep -l &quot;keyword&quot; .           # \u53ea\u663e\u793a\u6587\u4ef6\u540d\ngrep -n &quot;keyword&quot; file        # \u663e\u793a\u884c\u53f7\ngrep -v &quot;keyword&quot; file        # \u53cd\u5411\u5339\u914d\ngrep -E &quot;pattern&quot; file        # \u6269\u5c55\u6b63\u5219\n\n# \u7ec4\u5408\u4f7f\u7528\nfind . -name &quot;*.py&quot; | xargs grep &quot;def main&quot;\ngrep -r &quot;TODO&quot; --include=&quot;*.py&quot; .\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">9.4 \u6743\u9650\u4e0e\u6240\u6709\u6743<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u6743\u9650\nls -l\n\n# \u6743\u9650\u8bf4\u660e\n# -rwxr-xr-x\n# \u6587\u4ef6\u7c7b\u578b(rwx)\u7528\u6237(rwx)\u7ec4(rwx)\u5176\u4ed6\n# r=4, w=2, x=1\n\n# \u4fee\u6539\u6743\u9650\nchmod +x script.sh          # \u6dfb\u52a0\u6267\u884c\u6743\u9650\nchmod -x script.sh          # \u79fb\u9664\u6267\u884c\u6743\u9650\nchmod 755 file              # rwxr-xr-x\nchmod 644 file              # rw-r--r--\nchmod 600 file              # rw-------\nchmod -R 755 dir\/           # \u9012\u5f52\u4fee\u6539\n\n# \u4fee\u6539\u6240\u6709\u8005\nchown user:group file\nchown -R user:group dir\/    # \u9012\u5f52\u4fee\u6539\nsudo chown root:root file   # \u9700\u8981 sudo\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">9.5 \u538b\u7f29\u4e0e\u89e3\u538b<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# tar\ntar -czvf archive.tar.gz dir\/     # \u538b\u7f29\u4e3a .tar.gz\ntar -xzvf archive.tar.gz          # \u89e3\u538b .tar.gz\ntar -cjvf archive.tar.bz2 dir\/    # \u538b\u7f29\u4e3a .tar.bz2\ntar -xjvf archive.tar.bz2         # \u89e3\u538b .tar.bz2\ntar -tf archive.tar.gz            # \u67e5\u770b\u5185\u5bb9\n\n# zip\nzip -r archive.zip dir\/           # \u538b\u7f29\nunzip archive.zip                 # \u89e3\u538b\nunzip -l archive.zip              # \u67e5\u770b\u5185\u5bb9\nzip -d archive.zip file           # \u5220\u9664\u6587\u4ef6\n\n# gzip\ngzip file                         # \u538b\u7f29\u4e3a .gz\ngunzip file.gz                    # \u89e3\u538b\ngzip -d file.gz                   # \u540c\u4e0a\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">9.6 \u7cfb\u7edf\u4fe1\u606f<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u7cfb\u7edf\u4fe1\u606f\nuname -a              # \u6240\u6709\u4fe1\u606f\nuname -r              # \u5185\u6838\u7248\u672c\ncat \/etc\/os-release   # \u7cfb\u7edf\u7248\u672c\nhostname              # \u4e3b\u673a\u540d\n\n# \u78c1\u76d8\u7a7a\u95f4\ndf -h                 # \u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\ndf -i                 # inode \u4f7f\u7528\ndu -sh dirname        # \u76ee\u5f55\u5927\u5c0f\ndu -h --max-depth=1   # \u4e00\u7ea7\u5b50\u76ee\u5f55\u5927\u5c0f\ndu -ah | sort -hr | head -10  # Top 10 \u5927\u6587\u4ef6\n\n# \u5185\u5b58\nfree -h               # \u5185\u5b58\u4f7f\u7528\nfree -m               # \u4ee5 MB \u663e\u793a\n\n# CPU\nlscpu                 # CPU \u4fe1\u606f\nnproc                 # CPU \u6838\u5fc3\u6570\ntop                   # \u5b9e\u65f6\u8fdb\u7a0b\u76d1\u63a7\nhtop                  # \u589e\u5f3a\u7248 top\n\n# \u7f51\u7edc\nip addr               # IP \u5730\u5740\nifconfig              # \u65e7\u7248\u547d\u4ee4\nping google.com       # \u6d4b\u8bd5\u8fde\u901a\u6027\ncurl ifconfig.me      # \u67e5\u770b\u516c\u7f51 IP\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">9.7 \u8fdb\u7a0b\u7ba1\u7406<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u8fdb\u7a0b\nps aux                # \u6240\u6709\u8fdb\u7a0b\nps aux | grep python  # \u641c\u7d22\u8fdb\u7a0b\ntop                   # \u5b9e\u65f6\u76d1\u63a7\nhtop                  # \u589e\u5f3a\u7248\n\n# \u67e5\u770b\u7aef\u53e3\nnetstat -tuln         # \u76d1\u542c\u7aef\u53e3\nss -tuln              # \u65b0\u7248\u547d\u4ee4\nlsof -i :8080         # \u67e5\u770b\u7aef\u53e3\u5360\u7528\n\n# \u8fdb\u7a0b\u63a7\u5236\nkill PID              # \u7ec8\u6b62\u8fdb\u7a0b\nkill -9 PID           # \u5f3a\u5236\u7ec8\u6b62\nkill -15 PID          # \u4f18\u96c5\u7ec8\u6b62\npkill processname     # \u6309\u540d\u79f0\u7ec8\u6b62\nkillall processname   # \u540c\u4e0a\n\n# \u540e\u53f0\u8fd0\u884c\ncommand &amp;amp;             # \u540e\u53f0\u8fd0\u884c\njobs                  # \u67e5\u770b\u4f5c\u4e1a\nfg %1                 # \u5e26\u5230\u524d\u53f0\nbg %1                 # \u540e\u53f0\u7ee7\u7eed\nnohup command &amp;amp;       # \u9000\u51fa\u7ec8\u7aef\u540e\u7ee7\u7eed\u8fd0\u884c\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">9.8 \u7f51\u7edc\u76f8\u5173<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u4e0b\u8f7d\u6587\u4ef6\nwget url\nwget -O filename url          # \u6307\u5b9a\u6587\u4ef6\u540d\nwget -c url                   # \u65ad\u70b9\u7eed\u4f20\ncurl -O url                   # \u4e0b\u8f7d\ncurl -o filename url          # \u6307\u5b9a\u6587\u4ef6\u540d\n\n# \u7f51\u7edc\u6d4b\u8bd5\nping host                     # \u6d4b\u8bd5\u8fde\u901a\u6027\ntraceroute host               # \u8def\u7531\u8ffd\u8e2a\nmtr host                      # \u7ed3\u5408 ping \u548c traceroute\n\n# \u7aef\u53e3\u626b\u63cf\nn localhost                   # \u626b\u63cf\u672c\u5730\u7aef\u53e3\nn -p 80,443 host              # \u626b\u63cf\u6307\u5b9a\u7aef\u53e3\n\n# SSH\nssh user@host                 # \u8fdc\u7a0b\u8fde\u63a5\nssh -p 2222 user@host         # \u6307\u5b9a\u7aef\u53e3\nscp file user@host:\/path      # \u590d\u5236\u6587\u4ef6\nscp user@host:\/path\/file .    # \u4e0b\u8f7d\u6587\u4ef6\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">9.9 \u7ba1\u9053\u4e0e\u91cd\u5b9a\u5411<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u91cd\u5b9a\u5411\ncommand &gt; file                # \u8986\u76d6\u8f93\u51fa\ncommand &gt;&gt; file               # \u8ffd\u52a0\u8f93\u51fa\ncommand 2&gt; error.log          # \u91cd\u5b9a\u5411\u9519\u8bef\ncommand &gt; file 2&gt;&amp;amp;1           # \u91cd\u5b9a\u5411\u6240\u6709\u8f93\u51fa\ncommand &amp;amp;&gt; file               # \u540c\u4e0a\uff08bash\uff09\n\n# \u7ba1\u9053\nls -la | grep &quot;.git&quot;\ncat file | wc -l              # \u7edf\u8ba1\u884c\u6570\nps aux | grep python | wc -l  # \u7edf\u8ba1\u8fdb\u7a0b\u6570\n\n# xargs\nfind . -name &quot;*.txt&quot; | xargs rm\nfind . -name &quot;*.jpg&quot; | xargs -I {} mv {} backup\/\ncat files.txt | xargs -n 1    # \u6bcf\u6b21\u5904\u74061\u4e2a\n\n# tee\uff08\u540c\u65f6\u8f93\u51fa\u5230\u5c4f\u5e55\u548c\u6587\u4ef6\uff09\ncommand | tee output.log\ncommand | tee -a output.log   # \u8ffd\u52a0\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">9.10 WSL \u7279\u6709\u6307\u4ee4<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u8bbf\u95ee Windows \u6587\u4ef6\ncd \/mnt\/c\/Users\/username\ncd \/mnt\/d\/Projects\n\n# \u5728 Windows \u4e2d\u6253\u5f00\nexplorer.exe .                # \u6253\u5f00\u5f53\u524d\u76ee\u5f55\ncode .                        # VS Code \u6253\u5f00\nnotepad.exe file.txt          # \u8bb0\u4e8b\u672c\u6253\u5f00\n\n# Windows \u547d\u4ee4\n\/mnt\/c\/Windows\/System32\/cmd.exe \/c dir\npowershell.exe -Command &quot;Get-Process&quot;\n\n# \u7f51\u7edc\n# WSL2 \u4e2d localhost \u53ef\u80fd\u4e0d\u4e92\u901a\uff0c\u4f7f\u7528 Windows IP\ncat \/etc\/resolv.conf          # \u67e5\u770b nameserver\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">10. \u5e38\u89c1\u95ee\u9898\u4e0e\u89e3\u51b3\u65b9\u6848<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">10.1 .gitignore \u4e0d\u751f\u6548<\/h3>\n\n\n\n<p><strong>\u95ee\u9898<\/strong>: \u4fee\u6539\u4e86 <code>.gitignore<\/code>\uff0c\u4f46\u6587\u4ef6\u4ecd\u7136\u88ab\u8ffd\u8e2a\u3002<\/p>\n\n\n\n<p><strong>\u539f\u56e0<\/strong>: <code>.gitignore<\/code> \u53ea\u5bf9\u672a\u8ffd\u8e2a\u7684\u6587\u4ef6\u751f\u6548\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u6e05\u9664\u7f13\u5b58\u5e76\u91cd\u65b0\u6dfb\u52a0\ngit rm -r --cached .\ngit add .\ngit commit -m &quot;apply gitignore&quot;\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">10.2 \u8bef\u63d0\u4ea4\u4e86\u654f\u611f\u6587\u4ef6<\/h3>\n\n\n\n<p><strong>\u95ee\u9898<\/strong>: \u4e0d\u5c0f\u5fc3\u63d0\u4ea4\u4e86\u5bc6\u7801\u3001\u5bc6\u94a5\u7b49\u654f\u611f\u6587\u4ef6\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# 1. \u4ece\u6700\u8fd1\u4e00\u6b21\u63d0\u4ea4\u79fb\u9664\ngit reset HEAD~1\n# \u7f16\u8f91 .gitignore \u6dfb\u52a0\u654f\u611f\u6587\u4ef6\ngit add .\ngit commit -m &quot;...&quot;\n\n# 2. \u5982\u679c\u5df2\u63a8\u9001\uff0c\u4ece\u5386\u53f2\u4e2d\u5f7b\u5e95\u5220\u9664\ngit filter-branch --force --index-filter \\\n  &quot;git rm --cached --ignore-unmatch path\/to\/secret&quot; \\\n  --prune-empty --tag-name-filter cat -- --all\n\n# \u5f3a\u5236\u63a8\u9001\ngit push origin --force --all\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">10.3 \u63a8\u9001\u88ab\u62d2\u7edd<\/h3>\n\n\n\n<p><strong>\u95ee\u9898<\/strong>: <code>git push<\/code> \u63d0\u793a &#8220;rejected&#8221;\u3002<\/p>\n\n\n\n<p><strong>\u539f\u56e0<\/strong>: \u8fdc\u7a0b\u4ed3\u5e93\u6709\u672c\u5730\u6ca1\u6709\u7684\u63d0\u4ea4\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u65b9\u68481: \u5148\u62c9\u53d6\u518d\u63a8\u9001\ngit pull origin main\ngit push origin main\n\n# \u65b9\u68482: \u53d8\u57fa\u540e\u63a8\u9001\ngit pull --rebase origin main\ngit push origin main\n\n# \u65b9\u68483: \u5f3a\u5236\u63a8\u9001\uff08\u26a0\ufe0f \u4f1a\u8986\u76d6\u8fdc\u7a0b\uff09\ngit push -f origin main\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">10.4 \u5fd8\u8bb0\u6dfb\u52a0\u6587\u4ef6<\/h3>\n\n\n\n<p><strong>\u95ee\u9898<\/strong>: \u63d0\u4ea4\u540e\u53d1\u73b0\u6f0f\u4e86\u6587\u4ef6\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u6dfb\u52a0\u9057\u6f0f\u7684\u6587\u4ef6\ngit add forgotten_file.txt\n\n# \u4fee\u6539\u4e0a\u4e00\u6b21\u63d0\u4ea4\ngit commit --amend --no-edit\n\n# \u63a8\u9001\uff08\u9700\u8981\u5f3a\u5236\uff09\ngit push -f origin main\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">10.5 \u5206\u652f\u540d\u79f0\u4e0d\u4e00\u81f4<\/h3>\n\n\n\n<p><strong>\u95ee\u9898<\/strong>: \u672c\u5730\u662f <code>master<\/code>\uff0c\u8fdc\u7a0b\u662f <code>main<\/code>\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u91cd\u547d\u540d\u672c\u5730\u5206\u652f\ngit branch -m master main\n\n# \u8bbe\u7f6e\u4e0a\u6e38\u5206\u652f\ngit push -u origin main\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">10.6 \u5927\u6587\u4ef6\u8bef\u63d0\u4ea4<\/h3>\n\n\n\n<p><strong>\u95ee\u9898<\/strong>: \u63d0\u4ea4\u4e86\u5927\u6587\u4ef6\u5bfc\u81f4\u4ed3\u5e93\u4f53\u79ef\u8fc7\u5927\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u4f7f\u7528 Git LFS\uff08Large File Storage\uff09\ngit lfs install\ngit lfs track &quot;*.psd&quot;\ngit lfs track &quot;*.zip&quot;\n\n# \u6216\u8005\u4ece\u5386\u53f2\u4e2d\u79fb\u9664\ngit filter-branch --tree-filter 'rm -f largefile.zip' HEAD\ngit push -f origin main\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">10.7 \u8ba4\u8bc1\u5931\u8d25<\/h3>\n\n\n\n<p><strong>\u95ee\u9898<\/strong>: HTTPS \u63a8\u9001\u65f6\u8ba4\u8bc1\u5931\u8d25\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u65b9\u68481: \u4f7f\u7528 Personal Access Token\n# \u751f\u6210 Token: https:\/\/github.com\/settings\/tokens\n# \u4f7f\u7528 Token \u4ee3\u66ff\u5bc6\u7801\n\n# \u65b9\u68482: \u5207\u6362\u5230 SSH\ngit remote set-url origin git@github.com:user\/repo.git\n\n# \u65b9\u68483: \u4fdd\u5b58\u51ed\u8bc1\ngit config --global credential.helper cache\n# \u6216\u6c38\u4e45\u4fdd\u5b58\ngit config --global credential.helper store\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">10.8 \u51b2\u7a81\u89e3\u51b3<\/h3>\n\n\n\n<p><strong>\u95ee\u9898<\/strong>: \u5408\u5e76\u6216\u62c9\u53d6\u65f6\u51fa\u73b0\u51b2\u7a81\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# 1. \u67e5\u770b\u51b2\u7a81\u6587\u4ef6\ngit status\n\n# 2. \u7f16\u8f91\u51b2\u7a81\u6587\u4ef6\uff08\u89e3\u51b3 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; \u548c &gt;&gt;&gt;&gt;&gt;&gt;&gt; \u6807\u8bb0\uff09\n\n# 3. \u6807\u8bb0\u4e3a\u89e3\u51b3\ngit add resolved_file.txt\n\n# 4. \u5b8c\u6210\u5408\u5e76\ngit commit\n\n# \u6216\u53d6\u6d88\u5408\u5e76\ngit merge --abort\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">10.9 \u6062\u590d\u5220\u9664\u7684\u6587\u4ef6<\/h3>\n\n\n\n<p><strong>\u95ee\u9898<\/strong>: \u8bef\u5220\u4e86\u91cd\u8981\u6587\u4ef6\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u4ece\u6700\u8fd1\u4e00\u6b21\u63d0\u4ea4\u6062\u590d\ngit checkout HEAD -- filename\n\n# \u4ece\u6307\u5b9a\u63d0\u4ea4\u6062\u590d\ngit checkout &amp;lt;commit-hash&gt; -- filename\n\n# \u67e5\u770b\u6587\u4ef6\u5386\u53f2\ngit log -- filename\ngit reflog\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">10.10 \u67e5\u770b\u8c01\u4fee\u6539\u4e86\u4ee3\u7801<\/h3>\n\n\n\n<p><strong>\u95ee\u9898<\/strong>: \u60f3\u77e5\u9053\u67d0\u884c\u4ee3\u7801\u662f\u8c01\u3001\u4f55\u65f6\u4fee\u6539\u7684\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u6587\u4ef6\u6bcf\u4e00\u884c\u7684\u4f5c\u8005\ngit blame filename\n\n# \u67e5\u770b\u5177\u4f53\u63d0\u4ea4\ngit show &amp;lt;commit-hash&gt;\n\n# \u67e5\u770b\u6587\u4ef6\u4fee\u6539\u5386\u53f2\ngit log -p filename\ngit log --stat filename\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udccc \u5feb\u901f\u53c2\u8003\u5361\u7247<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Git \u6838\u5fc3\u6d41\u7a0b<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u65e5\u5e38\u5f00\u53d1\ngit pull origin main\ngit checkout -b feature\/new-feature\n# ... \u7f16\u5199\u4ee3\u7801 ...\ngit add .\ngit commit -m &quot;feat: add new feature&quot;\ngit push -u origin feature\/new-feature\n# \u521b\u5efa Pull Request\n\n# \u5e94\u7528 .gitignore\ngit rm -r --cached .\ngit add .\ngit commit -m &quot;chore: apply gitignore&quot;\ngit push\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">\u5e38\u7528\u7ec4\u5408<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u67e5\u770b\u72b6\u6001\u5e76\u6e05\u7406\ngit status &amp;amp;&amp;amp; git clean -fdn\n\n# \u67e5\u770b\u5927\u6587\u4ef6\nfind . -type f -size +100M -exec ls -lh {} \\;\n\n# \u7edf\u8ba1\u4ee3\u7801\u884c\u6570\nfind . -name &quot;*.py&quot; -o -name &quot;*.cpp&quot; | xargs wc -l\n\n# Git \u5ffd\u7565\u5e76\u63d0\u4ea4\ngit rm -r --cached . &amp;amp;&amp;amp; git add . &amp;amp;&amp;amp; git commit -m &quot;apply gitignore&quot;\n\n# \u67e5\u770b\u78c1\u76d8\u4f7f\u7528 Top 10\ndu -h --max-depth=1 | sort -hr | head -10\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">\u5feb\u6377\u522b\u540d\uff08\u6dfb\u52a0\u5230 ~\/.gitconfig\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;alias]\n    st = status\n    co = checkout\n    br = branch\n    ci = commit\n    last = log -1 HEAD\n    unstage = reset HEAD --\n    visual = !gitk\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udcda \u5b66\u4e60\u8d44\u6e90<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5b98\u65b9\u6587\u6863<\/strong>: https:\/\/git-scm.com\/doc<\/li>\n\n\n\n<li><strong>Pro Git \u4e66\u7c4d<\/strong>: https:\/\/git-scm.com\/book\/zh\/v2<\/li>\n\n\n\n<li><strong>GitHub \u6307\u5357<\/strong>: https:\/\/docs.github.com\/zh\/get-started<\/li>\n\n\n\n<li><strong>Git \u53ef\u89c6\u5316\u5b66\u4e60<\/strong>: https:\/\/learngitbranching.js.org\/<\/li>\n\n\n\n<li><strong>Linux \u547d\u4ee4\u624b\u518c<\/strong>: https:\/\/man7.org\/linux\/man-pages\/<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\u6587\u6863\u7248\u672c<\/strong>: v1.0<br><strong>\u6700\u540e\u66f4\u65b0<\/strong>: 2026-04-12<br><strong>\u4f5c\u8005<\/strong>: mo-fishkiller<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5982\u6709\u95ee\u9898\u6216\u5efa\u8bae\uff0c\u6b22\u8fce\u5728 GitHub \u63d0\u4ea4 Issue\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u6863\u8bb0\u5f55\u4e86\u5c06\u672c\u5730 Apollo_PnC \u5de5\u7a0b\u63a8\u9001\u5230 GitHub \u4ed3\u5e93\uff0c\u5e76\u901a\u8fc7 .gitignore \u5b9e\u73b0\u6587 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,1],"tags":[],"class_list":["post-150","post","type-post","status-publish","format-standard","hentry","category-lunix","category-learn"],"_links":{"self":[{"href":"https:\/\/momozi.online\/index.php\/wp-json\/wp\/v2\/posts\/150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/momozi.online\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/momozi.online\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/momozi.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/momozi.online\/index.php\/wp-json\/wp\/v2\/comments?post=150"}],"version-history":[{"count":1,"href":"https:\/\/momozi.online\/index.php\/wp-json\/wp\/v2\/posts\/150\/revisions"}],"predecessor-version":[{"id":151,"href":"https:\/\/momozi.online\/index.php\/wp-json\/wp\/v2\/posts\/150\/revisions\/151"}],"wp:attachment":[{"href":"https:\/\/momozi.online\/index.php\/wp-json\/wp\/v2\/media?parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/momozi.online\/index.php\/wp-json\/wp\/v2\/categories?post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/momozi.online\/index.php\/wp-json\/wp\/v2\/tags?post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}