
{"id":3749,"date":"2024-03-29T21:41:27","date_gmt":"2024-03-29T13:41:27","guid":{"rendered":"http:\/\/dba.qishuo.xin\/?p=3749"},"modified":"2024-03-29T21:49:48","modified_gmt":"2024-03-29T13:49:48","slug":"git%e5%b8%b8%e7%94%a8%e7%9a%84%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"http:\/\/dba.qishuo.xin\/?p=3749","title":{"rendered":"Git\u5e38\u7528\u7684\u64cd\u4f5c"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 ez-toc-wrap-right counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<label for=\"ez-toc-cssicon-toggle-item-6a028bd4e7ab1\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a028bd4e7ab1\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#1_git%E5%AE%89%E8%A3%85%EF%BC%88%E7%95%A5%EF%BC%89\" >1. git\u5b89\u88c5\uff08\u7565\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#2_git%E9%85%8D%E7%BD%AE%E7%BA%A7%E5%88%AB\" >2. git\u914d\u7f6e\u7ea7\u522b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#3_git%E5%9F%BA%E6%9C%AC%E6%93%8D%E4%BD%9C\" >3. git\u57fa\u672c\u64cd\u4f5c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#2_%E5%88%9B%E5%BB%BA%E6%9C%AC%E5%9C%B0%E4%BB%93%E5%BA%93\" >2. \u521b\u5efa\u672c\u5730\u4ed3\u5e93<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#21_%E5%9C%A8%E6%9C%AC%E5%9C%B0%E5%88%9B%E5%BB%BA%E7%A9%BA%E7%9B%AE%E5%BD%95\" >2.1. \u5728\u672c\u5730\u521b\u5efa\u7a7a\u76ee\u5f55<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#22_%E5%88%9D%E5%A7%8B%E5%8C%96%E4%BB%93%E5%BA%93\" >2.2. \u521d\u59cb\u5316\u4ed3\u5e93<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#23_%E6%9F%A5%E7%9C%8B%E5%BD%93%E5%89%8D%E4%BB%93%E5%BA%93%E7%9A%84%E9%85%8D%E7%BD%AE\" >2.3. \u67e5\u770b\u5f53\u524d\u4ed3\u5e93\u7684\u914d\u7f6e<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#24_%E8%AE%BE%E7%BD%AE%E5%BD%93%E5%89%8D%E4%BB%93%E5%BA%93%E7%9A%84%E7%94%A8%E6%88%B7%E5%90%8D%E4%BB%A5%E5%8F%8A%E9%82%AE%E7%AE%B1\" >2.4. \u8bbe\u7f6e\u5f53\u524d\u4ed3\u5e93\u7684\u7528\u6237\u540d\u4ee5\u53ca\u90ae\u7bb1<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#25_%E7%BC%93%E5%AD%98%E5%BD%93%E5%89%8D%E4%BB%93%E5%BA%93%E7%9A%84%E7%94%A8%E6%88%B7%E5%90%8D%E4%BB%A5%E5%8F%8A%E5%AF%86%E7%A0%81\" >2.5. \u7f13\u5b58\u5f53\u524d\u4ed3\u5e93\u7684\u7528\u6237\u540d\u4ee5\u53ca\u5bc6\u7801<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#26_%E6%B8%85%E9%99%A4%E5%BD%93%E5%89%8D%E4%BB%93%E5%BA%93%E7%BC%93%E5%AD%98%E7%9A%84%E7%94%A8%E6%88%B7%E5%90%8D%E5%92%8C%E5%AF%86%E7%A0%81\" >2.6. \u6e05\u9664\u5f53\u524d\u4ed3\u5e93\u7f13\u5b58\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#3_%E6%9C%AC%E5%9C%B0%E4%BB%93%E5%BA%93%E8%BF%9E%E6%8E%A5%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93\" >3. \u672c\u5730\u4ed3\u5e93\u8fde\u63a5\u8fdc\u7a0b\u4ed3\u5e93<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#31_%E4%BB%8E%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93%E5%85%8B%E9%9A%86\" >3.1. \u4ece\u8fdc\u7a0b\u4ed3\u5e93\u514b\u9686<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#32_%E6%89%8B%E5%8A%A8%E5%BB%BA%E7%AB%8B%E5%85%B3%E8%81%94\" >3.2. \u624b\u52a8\u5efa\u7acb\u5173\u8054<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#33_%E5%8F%96%E6%B6%88%E6%9C%AC%E5%9C%B0%E4%BB%93%E5%BA%93%E4%B8%8E%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93%E7%9A%84%E5%85%B3%E8%81%94\" >3.3. \u53d6\u6d88\u672c\u5730\u4ed3\u5e93\u4e0e\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5173\u8054<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#4_%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF%E6%93%8D%E4%BD%9C\" >4. \u672c\u5730\u5206\u652f\u64cd\u4f5c<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#41_%E6%96%B0%E5%BB%BA%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF\" >4.1. \u65b0\u5efa\u672c\u5730\u5206\u652f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#42_%E5%88%87%E6%8D%A2%E5%88%B0%E6%96%B0%E5%88%86%E6%94%AF\" >4.2. \u5207\u6362\u5230\u65b0\u5206\u652f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#43_%E5%88%9B%E5%BB%BA%E5%88%86%E6%94%AF%E5%90%8C%E6%97%B6%E4%B9%9F%E5%88%87%E6%8D%A2%E5%88%86%E6%94%AF\" >4.3. \u521b\u5efa\u5206\u652f\u540c\u65f6\u4e5f\u5207\u6362\u5206\u652f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#44_%E6%9F%A5%E7%9C%8B%E6%9C%AC%E5%9C%B0%E6%89%80%E6%9C%89%E5%88%86%E6%94%AF\" >4.4. \u67e5\u770b\u672c\u5730\u6240\u6709\u5206\u652f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#45_%E6%9F%A5%E7%9C%8B%E6%9C%AC%E5%9C%B0%E5%BD%93%E5%89%8D%E5%88%86%E6%94%AF\" >4.5. \u67e5\u770b\u672c\u5730\u5f53\u524d\u5206\u652f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#46_%E5%88%A0%E9%99%A4%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF\" >4.6. \u5220\u9664\u672c\u5730\u5206\u652f<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#5_%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E6%93%8D%E4%BD%9C\" >5. \u8fdc\u7a0b\u5206\u652f\u64cd\u4f5c<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#51_%E6%8B%89%E5%8F%96%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E5%88%B0%E6%9C%AC%E5%9C%B0%E4%BB%93%E5%BA%93\" >5.1. \u62c9\u53d6\u8fdc\u7a0b\u5206\u652f\u5230\u672c\u5730\u4ed3\u5e93<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#52_%E5%B0%86%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF%E6%8E%A8%E9%80%81%E5%88%B0%E8%BF%9C%E7%A8%8B\" >5.2. \u5c06\u672c\u5730\u5206\u652f\u63a8\u9001\u5230\u8fdc\u7a0b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#53_%E6%9F%A5%E7%9C%8B%E8%BF%9C%E7%A8%8B%E6%89%80%E6%9C%89%E5%88%86%E6%94%AF\" >5.3. \u67e5\u770b\u8fdc\u7a0b\u6240\u6709\u5206\u652f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#54_%E5%88%A0%E9%99%A4%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF\" >5.4. \u5220\u9664\u8fdc\u7a0b\u5206\u652f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#55_%E9%87%8D%E5%91%BD%E5%90%8D%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF\" >5.5. \u91cd\u547d\u540d\u8fdc\u7a0b\u5206\u652f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-28\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#56_%E6%9B%B4%E6%96%B0%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E7%9A%84%E6%9C%AC%E5%9C%B0%E5%88%97%E8%A1%A8\" >5.6. \u66f4\u65b0\u8fdc\u7a0b\u5206\u652f\u7684\u672c\u5730\u5217\u8868<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-29\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#6_git%E6%96%87%E4%BB%B6%E6%93%8D%E4%BD%9C\" >6. git\u6587\u4ef6\u64cd\u4f5c<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-30\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#61_%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E5%B9%B6%E6%8F%90%E4%BA%A4\" >6.1. \u65b0\u5efa\u6587\u4ef6\u5e76\u63d0\u4ea4<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-31\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#62_%E6%8E%A8%E9%80%81%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF%E5%88%B0%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF\" >6.2. \u63a8\u9001\u672c\u5730\u5206\u652f\u5230\u8fdc\u7a0b\u5206\u652f<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-32\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#7_%E6%8B%89%E5%8F%96%E6%9C%80%E6%96%B0%E4%BB%A3%E7%A0%81\" >7. \u62c9\u53d6\u6700\u65b0\u4ee3\u7801<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-33\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#%E9%99%84%E5%BD%95\" >\u9644\u5f55<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-34\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#%E9%99%84%E5%BD%95A_%E7%9B%B8%E5%85%B3%E8%81%94%E7%9A%84%E6%96%87%E7%AB%A0\" >\u9644\u5f55A. \u76f8\u5173\u8054\u7684\u6587\u7ae0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-35\" href=\"http:\/\/dba.qishuo.xin\/?p=3749\/#%E9%99%84%E5%BD%95B_%E5%8F%82%E8%80%83\" >\u9644\u5f55B. \u53c2\u8003<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"1_git%E5%AE%89%E8%A3%85%EF%BC%88%E7%95%A5%EF%BC%89\"><\/span>1. git\u5b89\u88c5\uff08\u7565\uff09<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u53c2\u89c1\uff1a<a target=\"_blank\" href=\"http:\/\/dba.qishuo.xin\/?p=3551\" title=\"Linux \u4e0b\u642d\u5efa Git \u5e76\u521b\u5efa\u4ed3\u5e93\">Linux \u4e0b\u642d\u5efa Git \u5e76\u521b\u5efa\u4ed3\u5e93<\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"2_git%E9%85%8D%E7%BD%AE%E7%BA%A7%E5%88%AB\"><\/span>2. git\u914d\u7f6e\u7ea7\u522b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Git\u67093\u4e2a\u7ea7\u522b\u7684\u914d\u7f6e\u6587\u4ef6\uff08local\u3001global\u3001system\uff09<\/p>\n<ul>\n<li>\n<p>local\uff1a\u533a\u57df\u4e3a\u672c\u4ed3\u5e93<br \/>\n\u672c\u5730\u7ea7\u522b\u7684\u914d\u7f6e\u4fdd\u5b58\u5728\u5f53\u524d\u4ed3\u5e93\u4e0b\u9762\u7684<code>.git\\config<\/code>\u6587\u4ef6\u5185\uff0c\u901a\u5e38 <code>.git<\/code> \u6587\u4ef6\u5939\u662f\u9690\u85cf\u7684\u3002\u8fd9\u91cc\u7684\u914d\u7f6e\u4ec5\u5bf9\u5f53\u524d\u4ed3\u5e93\u6709\u6548\uff0c\u4e0d\u5f71\u54cd\u5176\u4ed6\u7684\u4ed3\u5e93\u3002\u793a\u4f8b\u7528\u6cd5\uff1a<\/p>\n<pre><code class=\"language-shell\">## \u67e5\u770b\u5c40\u90e8\uff08\u5f53\u524d\u76ee\u5f55\uff09\u914d\u7f6e\u4fe1\u606f\ngit config --list --local --show-origin<\/code><\/pre>\n<\/li>\n<li>\n<p>global: \u5f53\u524d\u7528\u6237\u7684\u6240\u6709\u4ed3\u5e93<br \/>\n\u5168\u5c40\u7ea7\u914d\u7f6e\u6587\u4ef6\u5305\u542b\u5f53\u524d\u7cfb\u7edf\u7528\u6237\u7684\u62e5\u6709\u7684\u4ed3\u5e93\u914d\u7f6e\u503c\uff0c\u6bcf\u4e2a\u7cfb\u7edf\u7528\u6237\u7684\u5168\u5c40\u7ea7\u914d\u7f6e\u76f8\u4e92\u9694\u79bb\u3002\u5168\u5c40\u7ea7\u522b\u7684\u914d\u7f6e\u9ed8\u8ba4\u4fdd\u5b58\u5728\u5f53\u524d\u7cfb\u7edf\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e0b\u7684 <code>.gitconfig<\/code>(\u5982\uff1aroot\u7528\u6237\u7684\u6587\u4ef6\u4fdd\u5b58\u5728<code>\/root\/.gitconfig<\/code>) \u6587\u4ef6\u5185\u3002\u4f18\u5148\u5ea6\u6bd4\u7cfb\u7edf\u7ea7\u9ad8\uff0c\u53ef\u8986\u76d6\u7cfb\u7edf\u7ea7\u7684\u914d\u7f6e\u503c\u3002\u5168\u5c40\u7ea7\u7684\u914d\u7f6e\u5e73\u65f6\u4f7f\u7528\u5f97\u6bd4\u8f83\u591a\uff0c\u6bd4\u5982\u8bbe\u7f6e\u8d26\u53f7\u548c\u90ae\u7bb1\u3002\u793a\u4f8b\u7528\u6cd5\uff1a<\/p>\n<pre><code class=\"language-shell\">git config --list --global --show-origin<\/code><\/pre>\n<\/li>\n<li>\n<p>system: \u672c\u7cfb\u7edf\u7684\u6240\u6709\u7528\u6237<br \/>\n\u7cfb\u7edf\u7ea7\u914d\u7f6e\u6587\u4ef6\u542b\u6709\u7cfb\u7edf\u91cc\u6bcf\u4f4d\u7528\u6237\u53ca\u4ed6\u4eec\u6240\u62e5\u6709\u7684\u4ed3\u5e93\u7684\u914d\u7f6e\u503c\u3002\u5176\u4f4d\u7f6e\u4e3agit\u7684\u5b89\u88c5\u76ee\u5f55\u4e0b\u7684<code>\/etc\/gitconfig<\/code>\uff0c\u7cfb\u7edf\u914d\u7f6e\u5bf9\u6240\u6709\u7528\u6237\u548c\u6240\u6709 Git \u4ed3\u5e93\u90fd\u6709\u6548\u3002\u8bf7\u6ce8\u610f\uff0c\u4fee\u6539\u7cfb\u7edf\u914d\u7f6e\u901a\u5e38\u9700\u8981\u7ba1\u7406\u5458\u6743\u9650\u3002\u4f18\u5148\u5ea6\u6700\u4f4e\uff0c\u5176\u914d\u7f6e\u503c\u53ef\u88ab\u5168\u5c40\u7ea7\u914d\u7f6e\u548c\u672c\u5730\u7ea7\u914d\u7f6e\u7684\u503c\u8986\u76d6\u3002\u4e00\u822c\u6211\u4eec\u5f88\u5c11\u4f1a\u4f7f\u7528\u7cfb\u7edf\u7ea7\u7684\u914d\u7f6e\u3002\u793a\u4f8b\u7528\u6cd5\uff1a<\/p>\n<pre><code class=\"language-shell\">git config --list --system --show-origin<\/code><\/pre>\n<\/li>\n<\/ul>\n<p>\u4f18\u5148\u7ea7\uff1a<code>local &gt; global &gt; system<\/code><\/p>\n<h3><span class=\"ez-toc-section\" id=\"3_git%E5%9F%BA%E6%9C%AC%E6%93%8D%E4%BD%9C\"><\/span>3. git\u57fa\u672c\u64cd\u4f5c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Git \u7684\u5de5\u4f5c\u5c31\u662f\u521b\u5efa\u548c\u4fdd\u5b58\u4f60\u9879\u76ee\u7684\u5feb\u7167\u53ca\u4e0e\u4e4b\u540e\u7684\u5feb\u7167\u8fdb\u884c\u5bf9\u6bd4\u3002<\/p>\n<p>Git \u5e38\u7528\u7684\u662f\u4ee5\u4e0b 6 \u4e2a\u547d\u4ee4\uff1agit clone\u3001git push\u3001git add \u3001git commit\u3001git checkout\u3001git pull<\/p>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711719331353.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711719331353.png\" alt=\"file\" \/><\/a><\/p>\n<ul>\n<li>workspace\uff1a\u5de5\u4f5c\u533a<\/li>\n<li>staging area\uff1a\u6682\u5b58\u533a\/\u7f13\u5b58\u533a<\/li>\n<li>local repository\uff1a\u7248\u672c\u5e93\u6216\u672c\u5730\u4ed3\u5e93<\/li>\n<li>remote repository\uff1a\u8fdc\u7a0b\u4ed3\u5e93<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"2_%E5%88%9B%E5%BB%BA%E6%9C%AC%E5%9C%B0%E4%BB%93%E5%BA%93\"><\/span>2. \u521b\u5efa\u672c\u5730\u4ed3\u5e93<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"21_%E5%9C%A8%E6%9C%AC%E5%9C%B0%E5%88%9B%E5%BB%BA%E7%A9%BA%E7%9B%AE%E5%BD%95\"><\/span>2.1. \u5728\u672c\u5730\u521b\u5efa\u7a7a\u76ee\u5f55<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">mkdir \u9879\u76ee\u8def\u5f84(\u5982\uff1a\/dbData\/myProject)<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"22_%E5%88%9D%E5%A7%8B%E5%8C%96%E4%BB%93%E5%BA%93\"><\/span>2.2. \u521d\u59cb\u5316\u4ed3\u5e93<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">cd \/dbData\/myProject\ngit init\n# \u521d\u59cb\u5316\u4ed3\u5e93\u540e\uff0c\u67e5\u770b\u9690\u85cf\u7684.git\u76ee\u5f55\nls -lsa\nls .git<\/code><\/pre>\n<p>git\u76ee\u5f55\u4e0b\u8bb0\u5f55\u4e86\u9879\u76ee\u9700\u8981\u8bbe\u7f6e\u7684\u4fe1\u606f<\/p>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711708459419.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711708459419.png\" alt=\"file\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"23_%E6%9F%A5%E7%9C%8B%E5%BD%93%E5%89%8D%E4%BB%93%E5%BA%93%E7%9A%84%E9%85%8D%E7%BD%AE\"><\/span>2.3. \u67e5\u770b\u5f53\u524d\u4ed3\u5e93\u7684\u914d\u7f6e<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">git config --local --list<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711708756905.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711708756905.png\" alt=\"file\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"24_%E8%AE%BE%E7%BD%AE%E5%BD%93%E5%89%8D%E4%BB%93%E5%BA%93%E7%9A%84%E7%94%A8%E6%88%B7%E5%90%8D%E4%BB%A5%E5%8F%8A%E9%82%AE%E7%AE%B1\"><\/span>2.4. \u8bbe\u7f6e\u5f53\u524d\u4ed3\u5e93\u7684\u7528\u6237\u540d\u4ee5\u53ca\u90ae\u7bb1<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u6709\u4e9b\u65f6\u5019\u6211\u4eec\u7684\u670d\u52a1\u5668\u53ef\u80fd\u8981\u90e8\u7f72\u591a\u4e2agit\u4ed3\u5e93\uff0c\u4e0d\u540cgit\u4ed3\u5e93\u7684\u7528\u6237\u540d\u4ee5\u53ca\u5bc6\u7801\u90fd\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u6b64\u65f6\u9700\u8981\u6211\u4eec\u8bbe\u7f6e\u5355\u4e2a\u4ed3\u5e93\u7684\u7528\u6237\u540d\u4ee5\u53ca\u5bc6\u7801\u3002<\/p>\n<pre><code class=\"language-shell\">git config user.name &quot;userName&quot;       \/\/\u4f60\u7684\u7528\u6237\u540d\ngit config user.email &quot;email address&quot; \/\/\u4f60\u7684\u90ae\u7bb1\u5730\u5740<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711708853869.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711708853869.png\" alt=\"file\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"25_%E7%BC%93%E5%AD%98%E5%BD%93%E5%89%8D%E4%BB%93%E5%BA%93%E7%9A%84%E7%94%A8%E6%88%B7%E5%90%8D%E4%BB%A5%E5%8F%8A%E5%AF%86%E7%A0%81\"><\/span>2.5. \u7f13\u5b58\u5f53\u524d\u4ed3\u5e93\u7684\u7528\u6237\u540d\u4ee5\u53ca\u5bc6\u7801<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u8ba9git\u8bb0\u4f4f\u8d26\u53f7\u548c\u5bc6\u7801\u7684\u65b9\u6cd5\u662f\u5728<code>git bash<\/code> \u4e2d\u6267\u884c\u547d\u4ee4\uff1a<\/p>\n<pre><code class=\"language-shell\">## \u6c38\u4e45\u8bb0\u4f4f\ngit config credential.helper store\n## \u8bbe\u7f6e\u8bb0\u4f4f\u5bc6\u7801\uff08\u9ed8\u8ba4\u6709\u6548\u671f\u4e3a15\u5206\u949f\uff09\ngit config credential.helper cache\n## \u8bbe\u7f6e\u8bb0\u4f4f\u5bc6\u7801\uff08\u81ea\u5b9a\u4e49\u6709\u6548\u671f\uff09\uff0c\u4ee5\u4e0b\u547d\u4ee4\u4ee3\u8868\u6bcf 3600 \u79d2\u4f1a\u8ba9\u8f93\u5165\u4e00\u6b21\u8d26\u53f7\u548c\u5bc6\u7801\ngit config credential.helper &#039;cache --timeout=3600&#039;<\/code><\/pre>\n<p>\u8f93\u5165\u4e00\u6b21\u8d26\u53f7\u5bc6\u7801\u5c31\u53ef\u4ee5\u4fdd\u5b58\uff0c\u4e0b\u6b21\u4e0d\u518d\u63d0\u793a\u3002<\/p>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711709254683.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711709254683.png\" alt=\"file\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"26_%E6%B8%85%E9%99%A4%E5%BD%93%E5%89%8D%E4%BB%93%E5%BA%93%E7%BC%93%E5%AD%98%E7%9A%84%E7%94%A8%E6%88%B7%E5%90%8D%E5%92%8C%E5%AF%86%E7%A0%81\"><\/span>2.6. \u6e05\u9664\u5f53\u524d\u4ed3\u5e93\u7f13\u5b58\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">git config --unset credential.helper<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"3_%E6%9C%AC%E5%9C%B0%E4%BB%93%E5%BA%93%E8%BF%9E%E6%8E%A5%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93\"><\/span>3. \u672c\u5730\u4ed3\u5e93\u8fde\u63a5\u8fdc\u7a0b\u4ed3\u5e93<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"31_%E4%BB%8E%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93%E5%85%8B%E9%9A%86\"><\/span>3.1. \u4ece\u8fdc\u7a0b\u4ed3\u5e93\u514b\u9686<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><strong>\u53ef\u4e0d\u7528\u521d\u59cb\u5316git\u4ed3\u5e93\uff0c\u56e0\u4e3a\u8fdc\u7a0b\u62c9\u53d6\u5c31\u6709\uff01<\/strong><\/p>\n<pre><code class=\"language-shell\">git clone git@github.com:username\/repositoryname.git \uff08shh\u4ed3\u5e93\u5730\u5740\uff0c\u9700\u8981\u6dfb\u52a0\u5bc6\u94a5\uff09\ngit clone https:\/\/github.com\/dreamChaser-lcc\/xnsj.git \uff08https\u4ed3\u5e93\u5730\u5740\u4e0d\u9700\u8981\u5bc6\u94a5\uff09<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"32_%E6%89%8B%E5%8A%A8%E5%BB%BA%E7%AB%8B%E5%85%B3%E8%81%94\"><\/span>3.2. \u624b\u52a8\u5efa\u7acb\u5173\u8054<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">git remote add origin xxx \/\/xxx\u4e3a\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740\u5982\u4e0a\ngit remote -v  \/\/\u67e5\u770b\u662f\u5426\u6dfb\u52a0\u6210\u529f\ngit fetch origin  \/\/\u5411\u8fdc\u7a0b\u4ed3\u5e93\u62c9\u53d6\u5185\u5bb9\ngit branch -r \/\/\u67e5\u770b\u8fdc\u7a0b\u5206\u652f<\/code><\/pre>\n<p><span style='color:red'>origin\u5c31\u662f\u4ee3\u8868\u8fdc\u7a0b\u4ed3\u5e93\u7684\u76f8\u5173\u6570\u636e\uff0c\u5b83\u65e2\u5305\u542b\u8fdc\u7a0b\u4ed3\u5e93url\u4fe1\u606f\uff0c\u53c8\u5305\u62ec\u8fdc\u7a0b\u4ed3\u5e93\u5728\u672c\u5730\u7684\u7f13\u5b58\u5206\u652f\u4fe1\u606f\uff0c\u7f13\u5b58\u6587\u4ef6\u5939\u540d\u79f0\u7b49\u7b49\u3002<\/span><\/p>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711712412156.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711712412156.png\" alt=\"file\" \/><\/a><\/p>\n<p><strong>\u5207\u6362\u5230main\u5206\u652f\uff1a<\/strong><br \/>\n<a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711714090280.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711714090280.png\" alt=\"file\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"33_%E5%8F%96%E6%B6%88%E6%9C%AC%E5%9C%B0%E4%BB%93%E5%BA%93%E4%B8%8E%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93%E7%9A%84%E5%85%B3%E8%81%94\"><\/span>3.3. \u53d6\u6d88\u672c\u5730\u4ed3\u5e93\u4e0e\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5173\u8054<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">git remote remove origin<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"4_%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF%E6%93%8D%E4%BD%9C\"><\/span>4. \u672c\u5730\u5206\u652f\u64cd\u4f5c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"41_%E6%96%B0%E5%BB%BA%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF\"><\/span>4.1. \u65b0\u5efa\u672c\u5730\u5206\u652f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">git branch [branch name]\n## \u793a\u4f8b\ngit branch devteam1<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"42_%E5%88%87%E6%8D%A2%E5%88%B0%E6%96%B0%E5%88%86%E6%94%AF\"><\/span>4.2. \u5207\u6362\u5230\u65b0\u5206\u652f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">git checkout [branch name]\n## \u793a\u4f8b\ngit checkout devteam1<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"43_%E5%88%9B%E5%BB%BA%E5%88%86%E6%94%AF%E5%90%8C%E6%97%B6%E4%B9%9F%E5%88%87%E6%8D%A2%E5%88%86%E6%94%AF\"><\/span>4.3. \u521b\u5efa\u5206\u652f\u540c\u65f6\u4e5f\u5207\u6362\u5206\u652f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">git checkout -b [branch name]\n## \u793a\u4f8b\ngit checkout -b devteam2<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711714311023.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711714311023.png\" alt=\"file\" \/><\/a><\/p>\n<p>\u5047\u5982\u8fdc\u7a0b\u5206\u652f\u5df2\u5b58\u5728\uff0c\u53ef\u5728\u521b\u5efa\u672c\u5730\u5206\u652f\u65f6\u4e0e\u8fdc\u7a0b\u5206\u652f\u5173\u8054<\/p>\n<pre><code class=\"language-shell\">git checkout -b [\u672c\u5730\u5206\u652f\u540d\u79f0] origin\/[\u8fdc\u7a0b\u5206\u652f\u540d\u79f0]<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"44_%E6%9F%A5%E7%9C%8B%E6%9C%AC%E5%9C%B0%E6%89%80%E6%9C%89%E5%88%86%E6%94%AF\"><\/span>4.4. \u67e5\u770b\u672c\u5730\u6240\u6709\u5206\u652f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">git branch<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711714413921.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711714413921.png\" alt=\"file\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"45_%E6%9F%A5%E7%9C%8B%E6%9C%AC%E5%9C%B0%E5%BD%93%E5%89%8D%E5%88%86%E6%94%AF\"><\/span>4.5. \u67e5\u770b\u672c\u5730\u5f53\u524d\u5206\u652f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>\n<p>\u65b9\u6cd5\u4e00<\/p>\n<pre><code class=\"language-shell\">git branch --show-current<\/code><\/pre>\n<p>\u8be5\u547d\u4ee4\u5728Git\u7248\u672c2.22\u53ca\u4ee5\u4e0a\u7248\u672c\u4e2d\u624d\u53ef\u7528\u3002\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f\u8f83\u4f4e\u7248\u672c\u7684Git\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u5176\u4ed6\u65b9\u6cd5\u3002<\/p>\n<\/li>\n<li>\n<p>\u65b9\u6cd5\u4e8c<\/p>\n<pre><code class=\"language-shell\">git symbolic-ref --short HEAD<\/code><\/pre>\n<p><strong>\u8be5\u547d\u4ee4\u7528\u4e8e\u663e\u793aHEAD\u6307\u5411\u7684\u5206\u652f\u540d\u3002<\/strong><\/p>\n<\/li>\n<li>\n<p>\u65b9\u6cd5\u4e09<\/p>\n<pre><code class=\"language-shell\">git rev-parse --abbrev-ref HEAD<\/code><\/pre>\n<\/li>\n<\/ul>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711714647964.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711714647964.png\" alt=\"file\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"46_%E5%88%A0%E9%99%A4%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF\"><\/span>4.6. \u5220\u9664\u672c\u5730\u5206\u652f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">git branch -d [branch name]\n## \u793a\u4f8b\ngit branch -d devteam2<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711715113247.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711715113247.png\" alt=\"file\" \/><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"5_%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E6%93%8D%E4%BD%9C\"><\/span>5. \u8fdc\u7a0b\u5206\u652f\u64cd\u4f5c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"51_%E6%8B%89%E5%8F%96%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E5%88%B0%E6%9C%AC%E5%9C%B0%E4%BB%93%E5%BA%93\"><\/span>5.1. \u62c9\u53d6\u8fdc\u7a0b\u5206\u652f\u5230\u672c\u5730\u4ed3\u5e93<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>\n<p>git clone \u547d\u4ee4\u83b7\u53d6<\/p>\n<pre><code class=\"language-shell\">git clone -b dev\u5f00\u53d1\u5206\u652f http:\/\/xxx.xxx.xxx.xxx:9999\/aggregate-payment\/java-study.git<\/code><\/pre>\n<\/li>\n<li>\n<p>git fetch \u547d\u4ee4\u83b7\u53d6<\/p>\n<pre><code class=\"language-shell\">git fetch<\/code><\/pre>\n<\/li>\n<\/ul>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711713045146.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711713045146.png\" alt=\"file\" \/><\/a><br \/>\n\u7b2c\u4e00\u6b21\u62c9\u53d6\u9700\u8981\u8f93\u5165\u7528\u6237\u540d\u4e0e\u5bc6\u7801\u3002<\/p>\n<pre><code class=\"language-shell\">## \u62c9\u53d6\u524d\u5148\u6e05\u9664\u8fdc\u7a0b\u5206\u652f\u7684\u672c\u5730\u7f13\u5b58\ngit fetch -p origin<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"52_%E5%B0%86%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF%E6%8E%A8%E9%80%81%E5%88%B0%E8%BF%9C%E7%A8%8B\"><\/span>5.2. \u5c06\u672c\u5730\u5206\u652f\u63a8\u9001\u5230\u8fdc\u7a0b<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">git push [\u8fdc\u7a0b\u4e3b\u673a\u540d] [\u672c\u5730\u5206\u652f\u540d]:[\u8fdc\u7a0b\u5206\u652f\u540d]\n## \u793a\u4f8b\ngit push origin devteam1:releaseteam1<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711715596303.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711715596303.png\" alt=\"file\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"53_%E6%9F%A5%E7%9C%8B%E8%BF%9C%E7%A8%8B%E6%89%80%E6%9C%89%E5%88%86%E6%94%AF\"><\/span>5.3. \u67e5\u770b\u8fdc\u7a0b\u6240\u6709\u5206\u652f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">git branch -r<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711715642515.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711715642515.png\" alt=\"file\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"54_%E5%88%A0%E9%99%A4%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF\"><\/span>5.4. \u5220\u9664\u8fdc\u7a0b\u5206\u652f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>\n<p>\u5220\u9664\u5355\u4e2a\u5206\u652f\u540d\u79f0<\/p>\n<pre><code class=\"language-shell\">git push [\u8fdc\u7a0b\u4ed3\u5e93\u540d\u79f0] --delete [\u5206\u652f\u540d\u79f0]\n## \u793a\u4f8b\ngit push origin --delete releaseteam1<\/code><\/pre>\n<p><span style='color:red'>\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u5c06\u4ece\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u6c38\u4e45\u5220\u9664\u6307\u5b9a\u7684\u5206\u652f\u3002\u5728\u8fd9\u91cc\uff0c[\u8fdc\u7a0b\u4ed3\u5e93\u540d\u79f0]\u662f\u6307\u8981\u5220\u9664\u5206\u652f\u7684\u8fdc\u7a0b\u4ed3\u5e93\u7684\u540d\u79f0\uff0c[\u5206\u652f\u540d\u79f0]\u662f\u6307\u8981\u5220\u9664\u7684\u5206\u652f\u7684\u540d\u79f0\u3002<\/span><\/p>\n<\/li>\n<li>\n<p>\u5220\u9664\u591a\u4e2a\u8fdc\u7a0b\u5206\u652f<\/p>\n<pre><code class=\"language-shell\">git push [\u8fdc\u7a0b\u4ed3\u5e93\u540d\u79f0] --delete [\u5206\u652f\u540d\u79f01]  [\u5206\u652f\u540d\u79f02] ...<\/code><\/pre>\n<\/li>\n<\/ul>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711716813361.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711716813361.png\" alt=\"file\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"55_%E9%87%8D%E5%91%BD%E5%90%8D%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF\"><\/span>5.5. \u91cd\u547d\u540d\u8fdc\u7a0b\u5206\u652f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>\n<p>\u6b65\u9aa41\uff1a\u91cd\u547d\u540d\u8fdc\u7a0b\u5206\u652f\u5bf9\u5e94\u7684\u672c\u5730\u5206\u652f<\/p>\n<pre><code class=\"language-shell\">git branch -m [oldName] [newName]\n## \u793a\u4f8b\ngit branch -m devteam1 feat_study_java<\/code><\/pre>\n<\/li>\n<li>\n<p>\u6b65\u9aa42\uff1a\u5220\u9664\u8fdc\u7a0b\u5206\u652f<\/p>\n<pre><code class=\"language-shell\">git push origin --delete [oldName]\n## \u793a\u4f8b\ngit push origin --delete releaseteam1<\/code><\/pre>\n<\/li>\n<li>\n<p>\u6b65\u9aa43\uff1a\u63a8\u9001\u65b0\u547d\u540d\u7684\u672c\u5730\u5206\u652f<\/p>\n<pre><code class=\"language-shell\">git push origin [newName]\n## \u793a\u4f8b\ngit push origin feat_study_java<\/code><\/pre>\n<\/li>\n<li>\n<p>\u6b65\u9aa44\uff1a\u628a\u4fee\u6539\u540e\u7684\u672c\u5730\u5206\u652f\u4e0e\u8fdc\u7a0b\u5206\u652f\u5173\u8054<\/p>\n<pre><code class=\"language-shell\">git branch --set-upstream-to [origin\/newName]\n## \u793a\u4f8b\ngit branch --set-upstream-to origin\/feat_study_java<\/code><\/pre>\n<\/li>\n<\/ul>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711718166190.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711718166190.png\" alt=\"file\" \/><\/a><\/p>\n<p><strong><span style='color:red'>\u5f53\u672c\u5730\u5206\u652f\u65f6\u4e0e\u8fdc\u7a0b\u5206\u652f\u5173\u8054\u65f6\u5c31\u53ef\u4ee5\u76f4\u63a5 <code>git push<\/code> \u63d0\u4ea4!!!<\/span><\/strong><\/p>\n<h4><span class=\"ez-toc-section\" id=\"56_%E6%9B%B4%E6%96%B0%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E7%9A%84%E6%9C%AC%E5%9C%B0%E5%88%97%E8%A1%A8\"><\/span>5.6. \u66f4\u65b0\u8fdc\u7a0b\u5206\u652f\u7684\u672c\u5730\u5217\u8868<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5f53\u8fdc\u7a0b\u4e0a\u7684\u5206\u652f\u5220\u9664\u65f6\uff0c\u9700\u8981\u66f4\u65b0\u672c\u5730\u5217\u8868\u4e2d\u8fdc\u7a0b\u5206\u652f\u3002<\/p>\n<pre><code class=\"language-shell\">git remote update origin --prune<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711416684262.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711416684262.png\" alt=\"file\" \/><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"6_git%E6%96%87%E4%BB%B6%E6%93%8D%E4%BD%9C\"><\/span>6. git\u6587\u4ef6\u64cd\u4f5c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"61_%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E5%B9%B6%E6%8F%90%E4%BA%A4\"><\/span>6.1. \u65b0\u5efa\u6587\u4ef6\u5e76\u63d0\u4ea4<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell\">## \u6dfb\u52a0\u6587\u4ef6\u5230\u6682\u5b58\u533a\ngit add [file name]\n## \u67e5\u770b\u4ed3\u5e93\u5f53\u524d\u7684\u72b6\u6001\uff0c\u663e\u793a\u6709\u53d8\u66f4\u7684\u6587\u4ef6\u3002\ngit status\n## \u5c06\u6682\u5b58\u533a\u5185\u5bb9\u6dfb\u52a0\u5230\u672c\u5730\u4ed3\u5e93\u4e2d\ngit commit -m &quot;\u63d0\u4ea4\u6587\u4ef6\u6ce8\u91ca&quot;<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711718448124.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711718448124.png\" alt=\"file\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"62_%E6%8E%A8%E9%80%81%E6%9C%AC%E5%9C%B0%E5%88%86%E6%94%AF%E5%88%B0%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF\"><\/span>6.2. \u63a8\u9001\u672c\u5730\u5206\u652f\u5230\u8fdc\u7a0b\u5206\u652f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><strong><code>git push<\/code> \u547d\u4ee4\u7528\u4e8e\u4ece\u5c06\u672c\u5730\u7684\u5206\u652f\u7248\u672c\u4e0a\u4f20\u5230\u8fdc\u7a0b\u5e76\u5408\u5e76\u3002<\/strong><\/p>\n<pre><code class=\"language-shell\">git push [\u8fdc\u7a0b\u4ed3\u5e93\u540d\u79f0] [\u672c\u5730\u5206\u652f\u540d]:[\u8fdc\u7a0b\u5206\u652f\u540d]\n## \u793a\u4f8b\ngit push origin feat_study_java:feat_study_java<\/code><\/pre>\n<p>\u5982\u679c\u672c\u5730\u5206\u652f\u540d\u4e0e\u8fdc\u7a0b\u5206\u652f\u540d\u76f8\u540c\uff0c\u5219\u53ef\u4ee5\u7701\u7565\u5192\u53f7\uff1a<\/p>\n<pre><code class=\"language-shell\">git push [\u8fdc\u7a0b\u4ed3\u5e93\u540d\u79f0] [\u672c\u5730\u5206\u652f\u540d]\n## \u793a\u4f8b\ngit push origin feat_study_java<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711718743140.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711718743140.png\" alt=\"file\" \/><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"7_%E6%8B%89%E5%8F%96%E6%9C%80%E6%96%B0%E4%BB%A3%E7%A0%81\"><\/span>7. \u62c9\u53d6\u6700\u65b0\u4ee3\u7801<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><code>git pull<\/code>\u662f\u5728\u63d0\u4ea4\u5230\u8fdc\u7a0b\u4ed3\u5e93\u4e4b\u524d\uff0c\u5148\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u4ee3\u7801\uff0c\u9632\u6b62\u548c\u522b\u4eba\u4ee3\u7801\u4ea7\u751f\u51b2\u7a81\u3002<\/p>\n<pre><code class=\"language-shell\">git pull origin [\u8fdc\u7a0b\u5206\u652f\u540d]<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711720107814.png\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2024\/03\/image-1711720107814.png\" alt=\"file\" \/><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E9%99%84%E5%BD%95\"><\/span>\u9644\u5f55<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"%E9%99%84%E5%BD%95A_%E7%9B%B8%E5%85%B3%E8%81%94%E7%9A%84%E6%96%87%E7%AB%A0\"><\/span>\u9644\u5f55A. \u76f8\u5173\u8054\u7684\u6587\u7ae0<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li><a target=\"_blank\" href=\"http:\/\/dba.qishuo.xin\/?p=3551\" title=\"Linux \u4e0b\u642d\u5efa Git \u5e76\u521b\u5efa\u4ed3\u5e93\">Linux \u4e0b\u642d\u5efa Git \u5e76\u521b\u5efa\u4ed3\u5e93<\/a><\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"%E9%99%84%E5%BD%95B_%E5%8F%82%E8%80%83\"><\/span>\u9644\u5f55B. \u53c2\u8003<span class=\"ez-toc-section-end\"><\/span><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>1. git\u5b89\u88c5\uff08\u7565\uff09 \u53c2\u89c1\uff1aLinux \u4e0b\u642d\u5efa &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[257],"tags":[267,261],"class_list":["post-3749","post","type-post","status-publish","format-standard","hentry","category-git","tag-git","tag-gitlab"],"_links":{"self":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/3749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3749"}],"version-history":[{"count":36,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/3749\/revisions"}],"predecessor-version":[{"id":3806,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/3749\/revisions\/3806"}],"wp:attachment":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3749"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}