{"id":203,"date":"2023-02-10T15:16:27","date_gmt":"2023-02-10T07:16:27","guid":{"rendered":"https:\/\/www.tysql.com\/?p=203"},"modified":"2025-01-17T16:08:31","modified_gmt":"2025-01-17T08:08:31","slug":"git%e5%91%bd%e4%bb%a4%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/www.tysql.com\/index.php\/2023\/02\/10\/git%e5%91%bd%e4%bb%a4%e6%93%8d%e4%bd%9c\/","title":{"rendered":"git\u547d\u4ee4\u64cd\u4f5c"},"content":{"rendered":"\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">\/\/ \u66f4\u65b0\u5230\u8fdc\u7a0b\u4ed3\u5e93\n$ git add .    \/\/\u6307\u5b9a\u66f4\u65b0\u5185\u5bb9    . \u8868\u793a\u5168\u90e8\u66f4\u65b0\uff0ctest.txt \u8868\u793a\u66f4\u65b0\u6307\u5b9a\u6587\u4ef6\n$ git commit -m &quot;\u4e00\u4e9b\u6ce8\u91ca\u8bf4\u660e&quot;     \/\/\u6dfb\u52a0\u66f4\u65b0\u8bf4\u660e\n$ git push origin master            \/\/\u6267\u884c\u66f4\u65b0\u64cd\u4f5c\n\n\/\/ \u4ece\u8fdc\u7a0b\u4ed3\u5e93\u540c\u6b65\u6700\u65b0\u7248\u672c\u5230\u672c\u5730\n$ git pull origin master\n\n\/\/ \u514b\u9686\n$ git clone https:\/\/gitee.com\/yourname\/repository\n\n\/\/ \u672c\u5730\u521d\u59cb\u5316\n$ git init \/\/\u521d\u59cb\u5316\u672c\u5730\u9879\u76ee\n$ git remote add origin &lt;\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740&gt; \/\/\u7ed1\u5b9a\u8fdc\u7a0b\u4ed3\u5e93\n#\u6ce8:\u5730\u5740\u5f62\u5f0f\u4e3a https:\/\/gitee.com\/yourname\/test.git \u6216 git@gitee.com:yourname\/test.git\n\n\/\/\u67e5\u770b\u6240\u5728\u76ee\u5f55\u7684\u5206\u652f -a\u8868\u793a\u6240\u6709\ngit branch -a\n\/\/\u8f93\u5165\u547d\u4ee4\u5207\u6362\u5206\u652f\n\u9002\u7528\u4e8e\u7b2c\u4e00\u6b21\u521b\u5efa\u5e76\u5207\u6362\u5206\u652f\n$ git checkout -b develop origin\/develop\n\/\/ \u5176\u4e2d\u8fdc\u7a0b\u5206\u652f\u4e3aorigin\/develop,\u672c\u5730\u5206\u652f\u4e3azhanghanlun\n\u5982\u679c\u5df2\u7ecf\u6709\u672c\u5730\u5206\u652f,\u76f4\u63a5\u8f93\u5165\u547d\u4ee4\n$git checkout develop\n\n\/\/ \u5f3a\u5236\u63a8\u9001\uff0c\u6ce8\u610f\u4f1a\u5f3a\u5236\u5220\u9664\u539f\u6709\u4ed3\u5e93\u4e2d\u7684\u67d0\u4e9b\u4ee3\u7801\n$git push -u origin master -f\n\/\/ \u5982\u679c\u672c\u5730\u7248\u672c\u4e0e\u8fdc\u7a0b\u7248\u672c\u6709\u5dee\u5f02\uff0c\u4f46\u53c8\u8981\u5f3a\u5236\u63a8\u9001\uff0c\u4f7f\u7528 --force \u53c2\u6570\uff1a\ngit push --force origin master\n\ngit \u672c\u5730\u6539\u52a8\u4e86\uff0c\u4e0d\u4fdd\u7559\uff0c\u76f4\u63a5\u62c9\u53d6\u7ebf\u4e0a\u6700\u65b0\u4ee3\u7801\ngit fetch --all  \ngit reset --hard origin\/master\n\n\/\/git\u62c9\u53d6\u8fdc\u7a0b\u4ee3\u7801\u5e76\u521b\u5efa\u672c\u5730\u5206\u652f\ngit checkout -b dev\uff08\u672c\u5730\u5206\u652f\u540d\uff09 origin\/dev\uff08\u8fdc\u7a0b\u5206\u652f\u540d\uff09\n\/\/\u5982\u679c\u6267\u884c\u547d\u4ee4\u62a5\u9519\uff0c\u53ef\u80fd\u662f\u6ca1\u6709\u66f4\u65b0\u8fdc\u7a0b\u4ed3\u5e93\u4fe1\u606f\uff0c\u8fd9\u65f6\u5019\u9700\u8981\u624b\u52a8\u66f4\u65b0\u4e0b\u8fdc\u7a0b\u4ed3\u5e93\u4fe1\u606f\uff0c\u6267\u884c\u547d\u4ee4git fetch origin\uff0c\u518d\u6267\u884cgit branch -a\u53ef\u4ee5\u770b\u5230\u6700\u65b0\u7684\u8fdc\u7a0b\u4ed3\u5e93\u4fe1\u606f\uff0c\u7136\u540e\u518d\u91cd\u65b0\u6267\u884cgit checkout -b dev\uff08\u672c\u5730\u5206\u652f\u540d\uff09 origin\/dev\uff08\u8fdc\u7a0b\u5206\u652f\u540d\uff09\n<\/pre><\/div>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">git tag v1.0  # \u7ed9\u5f53\u524d\u7248\u672c\u6253\u4e0a\u540d\u4e3av1.0\u7684\u6807\u7b7e\ngit push origin v1.0  # \u5c06\u540d\u4e3av1.0\u7684\u6807\u7b7e\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\ngit push --tags  # \u5c06\u6240\u6709\u672c\u5730\u7684\u6807\u7b7e\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-203","post","type-post","status-publish","format-standard","hentry","category-17"],"_links":{"self":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts\/203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/comments?post=203"}],"version-history":[{"count":6,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":311,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts\/203\/revisions\/311"}],"wp:attachment":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/media?parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/categories?post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/tags?post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}