{"id":19339,"date":"2024-11-19T13:14:52","date_gmt":"2024-11-19T05:14:52","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19339\/"},"modified":"2024-11-19T13:14:52","modified_gmt":"2024-11-19T05:14:52","slug":"gitlab%e4%b8%8a%e6%80%8e%e4%b9%88%e4%b8%80%e6%ac%a1%e5%88%a0%e9%99%a4%e5%a4%9a%e4%b8%aa%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19339\/","title":{"rendered":"GitLab\u4e0a\u600e\u4e48\u4e00\u6b21\u5220\u9664\u591a\u4e2a\u6587\u4ef6"},"content":{"rendered":"<p>git lab\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u5176\u4e2d\u5305\u62ec\u5bf9\u4ee3\u7801\u7684\u8ffd\u8e2a\u3001\u5907\u4efd\u548c\u534f\u4f5c\u7b49\u529f\u80fd\u3002\u5728\u4f7f\u7528 git lab \u8fdb\u884c\u4ee3\u7801\u7ba1\u7406\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u9700\u8981\u5220\u9664\u591a\u4e2a\u6587\u4ef6\u7684\u60c5\u51b5\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728 gitlab \u4e0a\u4e00\u6b21\u5220\u9664\u591a\u4e2a\u6587\u4ef6\u3002<\/p>\n<p>\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<p>\u6b65\u9aa41\uff1a\u4f7f\u7528 Git \u547d\u4ee4\u884c\u6a21\u5f0f\u5bfc\u822a\u5230 Git \u4ed3\u5e93\u6240\u5728\u4f4d\u7f6e\u3002<\/p>\n<p>\u5728 Windows \u7cfb\u7edf\u4e2d\uff0c\u4f7f\u7528 PowerShell \u6253\u5f00\u7ec8\u7aef\uff0c\u7136\u540e\u5207\u6362\u5230 Git \u4ed3\u5e93\u6240\u5728\u7684\u76ee\u5f55\u3002<\/p>\n<p>\u6b65\u9aa42\uff1a\u4f7f\u7528 Git status \u547d\u4ee4\u68c0\u67e5\u6587\u4ef6\u72b6\u6001\u3002<\/p>\n<p>\u5728 Git \u4ed3\u5e93\u76ee\u5f55\u4e0b\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git status<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8be5\u547d\u4ee4\u5c06\u8fd4\u56de\u4e00\u4e2a\u6709\u5173 Git \u4ed3\u5e93\u72b6\u6001\u7684\u6982\u8ff0\uff0c\u5305\u62ec\u6240\u9700\u64cd\u4f5c\u7684\u6587\u4ef6\u5217\u8868\u3002\u8f93\u51fa\u5e94\u7c7b\u4f3c\u4e8e\u4e0b\u9762\u7684\u793a\u4f8b\uff1a<\/p>\n<pre>On branch master\nYour branch is up-to-date with 'origin\/master'.\n\nChanges not staged for commit:\n  (use \"git add &lt;file&gt;...\" to update what will be committed)\n  (use \"git checkout -- &lt;file&gt;...\" to discard changes in working directory)\n\n        deleted:    file1.txt\n        deleted:    file2.txt\n\nno changes added to commit (use \"git add\" and\/or \"git commit -a\")<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6b64\u8f93\u51fa\u8868\u793a\u6709\u4e24\u4e2a\u6587\u4ef6\u5df2\u7ecf\u51c6\u5907\u597d\u4ece Git \u4ed3\u5e93\u4e2d\u5220\u9664\u3002<\/p>\n<p>\u6b65\u9aa43\uff1a\u4f7f\u7528 Git rm \u547d\u4ee4\u5220\u9664\u6587\u4ef6\u3002<\/p>\n<p>\u4e0b\u9762\u7684\u547d\u4ee4\u53ef\u4ee5\u4e00\u6b21\u5220\u9664\u591a\u4e2a\u6587\u4ef6\uff1a<\/p>\n<pre>git rm file1.txt file2.txt<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679c\u4ec5\u9700\u8981\u5220\u9664\u4e00\u4e2a\u6587\u4ef6\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git rm file1.txt<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u786e\u5b9a\u63d0\u4ea4\u4e4b\u524d\uff0c\u8bf7\u7528 Git status \u786e\u8ba4\u6b63\u786e\u7684\u6587\u4ef6\u5df2\u88ab\u5220\u9664\u3002<\/p>\n<p>\u6b65\u9aa44\uff1a\u4f7f\u7528 Git commit \u547d\u4ee4\u63d0\u4ea4\u66f4\u6539\u3002<\/p>\n<p>\u4f7f\u7528 Git commit \u547d\u4ee4\u63d0\u4ea4\u66f4\u6539\uff0c\u5e76\u5305\u62ec\u6709\u5173\u5220\u9664\u6587\u4ef6\u7684\u6ce8\u91ca\uff1a<\/p>\n<pre>git commit -m \"Deleted files: file1.txt and file2.txt\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u63d0\u4ea4\u540e\uff0cGit \u5c06\u5220\u9664\u5df2\u5220\u9664\u7684\u6587\u4ef6\u3002<\/p>\n<p>\u603b\u7ed3\uff1a<\/p>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\u53ef\u4ee5\u8f7b\u677e\u5728 Git Lab \u4e0a\u4e00\u6b21\u5220\u9664\u591a\u4e2a\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<ul>\n<li>\u5982\u679c\u6587\u4ef6\u5df2\u7ecf\u88ab\u63d0\u4ea4\u5230 Git \u4ed3\u5e93\u4e2d\uff0c\u5219\u5fc5\u987b\u4f7f\u7528 Git revert \u547d\u4ee4\uff0c\u4ee5\u53cd\u8f6c\u63d0\u4ea4\u5e76\u5220\u9664\u6587\u4ef6\u3002<\/li>\n<li>\u5982\u679c\u6587\u4ef6\u5939\u4e2d\u7684\u6587\u4ef6\u9700\u8981\u88ab\u5220\u9664\uff0c\u5219\u5fc5\u987b\u4f7f\u7528\u5e26\u6709\u9012\u5f52\u9009\u9879\u7684 Git rm \u547d\u4ee4\uff0c\u4f8b\u5982\uff1a<\/li>\n<\/ul>\n<pre>git rm -r folder-name<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6700\u540e\uff0c\u8981\u6ce8\u610f Git rm \u547d\u4ee4\u4ece Git \u4ed3\u5e93\u4e2d\u6c38\u4e45\u5220\u9664\u6587\u4ef6\uff0c\u56e0\u6b64\u5728\u5220\u9664\u4e4b\u524d\uff0c\u786e\u4fdd\u5df2\u7ecf\u505a\u597d\u5fc5\u8981\u7684\u5907\u4efd\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fGitLab\u4e0a\u600e\u4e48\u4e00\u6b21\u5220\u9664\u591a\u4e2a\u6587\u4ef6\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>git lab\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u5176\u4e2d\u5305\u62ec\u5bf9\u4ee3\u7801\u7684\u8ffd\u8e2a\u3001\u5907\u4efd\u548c\u534f\u4f5c\u7b49\u529f\u80fd\u3002\u5728\u4f7f\u7528 git lab \u8fdb\u884c\u4ee3\u7801\u7ba1\u7406\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u9700\u8981\u5220\u9664\u591a\u4e2a\u6587\u4ef6\u7684\u60c5\u51b5\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728 gitlab \u4e0a\u4e00\u6b21\u5220\u9664\u591a\u4e2a\u6587\u4ef6\u3002 \u6b65\u9aa4\u5982\u4e0b\uff1a \u6b65\u9aa41\uff1a\u4f7f\u7528 Git \u547d\u4ee4\u884c\u6a21\u5f0f\u5bfc\u822a\u5230 Git \u4ed3\u5e93\u6240\u5728\u4f4d\u7f6e\u3002 \u5728 Windows \u7cfb\u7edf\u4e2d\uff0c\u4f7f\u7528 PowerShell \u6253\u5f00\u7ec8\u7aef\uff0c\u7136\u540e\u5207\u6362\u5230 Git \u4ed3\u5e93\u6240\u5728\u7684\u76ee\u5f55\u3002 \u6b65\u9aa42\uff1a\u4f7f\u7528 Git status \u547d\u4ee4\u68c0\u67e5\u6587\u4ef6\u72b6\u6001\u3002 \u5728 Git \u4ed3\u5e93\u76ee\u5f55\u4e0b\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a git status \u767b\u5f55\u540e\u590d\u5236 \u8be5\u547d\u4ee4\u5c06\u8fd4\u56de\u4e00\u4e2a\u6709\u5173 Git \u4ed3\u5e93\u72b6\u6001\u7684\u6982\u8ff0\uff0c\u5305\u62ec\u6240\u9700\u64cd\u4f5c\u7684\u6587\u4ef6\u5217\u8868\u3002\u8f93\u51fa\u5e94\u7c7b\u4f3c\u4e8e\u4e0b\u9762\u7684\u793a\u4f8b\uff1a On branch master Your branch is up-to-date with &#8216;origin\/master&#8217;. Changes not staged for commit: (use &#8220;git add &lt;file&gt;&#8230;&#8221; to update what will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-19339","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=19339"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19339\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}