{"id":37319,"date":"2022-11-24T10:00:45","date_gmt":"2023-07-02T11:27:36","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/"},"modified":"2024-04-29T02:15:55","modified_gmt":"2024-04-28T18:15:55","slug":"%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/","title":{"rendered":"\u5f00\u59cb\u4f7f\u7528Git\u5427\uff01"},"content":{"rendered":"<p>\u9488\u5bf9Git\u7684\u521d\u5b66\u8005\u7684\u6587\u7ae0\u3002<\/p>\n<h2>\u673a\u5236<\/h2>\n<p>Git\u4f7f\u7528\u5feb\u7167\u8fdb\u884c\u8bb0\u5f55\u3002\u672a\u7ecf\u4fee\u6539\u7684\u6587\u4ef6\u5c06\u5728\u4e0b\u4e00\u4e2a\u7248\u672c\u4e2d\u4fdd\u6301\u4e0d\u53d8\u3002<br \/>\n\u901a\u8fc7\u4f7f\u7528\u5feb\u7167\u8fdb\u884c\u8bb0\u5f55\uff0c\u53ef\u4ee5\u63d0\u9ad8\u591a\u4eba\u5f00\u53d1\u65f6\u7684\u901f\u5ea6\u3002<\/p>\n<p>\u56e0\u4e3a\u5728\u63d0\u4ea4\u65f6\u4f1a\u8bb0\u4f4f\u4e0a\u4e00\u6b21\u7684\u63d0\u4ea4\u4fe1\u606f\u3002<br \/>\n\u5982\u679c\u8bb0\u5f55\u7248\u672c\uff0c\u5c31\u53ef\u4ee5\u56de\u6eda\u5230\u5148\u524d\u7684\u7248\u672c\u3002<\/p>\n<p>\u63d0\u4ea4\u8bb0\u5f55\u4e2d\u8bb0\u5f55\u4e86\u524d\u4e00\u6b21\u63d0\u4ea4\u3001\u4f5c\u8005\u3001\u65e5\u671f\u548c\u63d0\u4ea4\u4fe1\u606f\u3002<\/p>\n<p>\u672c\u5730\uff1a\u6211\u7684\u7535\u8111<br \/>\n\u8fdc\u7a0b\u4ed3\u5e93\uff1aGitLab<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30ed\u30fc\u30ab\u30eb\u306f3\u3064\u5206\u3051\u3089\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30ea\u30dd\u30b8\u30c8\u30ea\uff1a\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u3092\u8a18\u9332\uff08git commit\uff09<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30b9\u30c6\u30fc\u30b8\uff1a\u5909\u66f4\u304c\u5b8c\u4e86\u3057\u305f\u3082\u306e\u3060\u3051\u3092\u8a18\u9332\u3001\u5909\u66f4\u9014\u4e2d\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u7f6e\u304b\u306a\u3044\uff08git add\uff09<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30ef\u30fc\u30af\u30c4\u30ea\u30fc\uff1aVS\u30b3\u30fc\u30c9<\/ul>\n<h2>\u5982\u4f55\u5f00\u59cb\u4f7f\u7528Git<\/h2>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u81ea\u5206\u3067\u65b0\u898f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u306e\u5834\u5408\u3092\u4ee5\u4e0b\u3092\u884c\u3046<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">git init \u3067\u30ed\u30fc\u30ab\u30eb\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u4f5c\u6210\u3055\u308c\u308b\uff08.git\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff09<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">.git\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u96a0\u3057\u30d5\u30a9\u30eb\u30c0\u306a\u306e\u3067ls -a \u3067\u78ba\u8a8d\u3067\u304d\u308b\u3002<\/ul>\n<details>\u8ba9\u6211\u4eec\u68c0\u67e5.git\u6587\u4ef6\u5939\u7684\u5185\u5bb9\uff1a<br \/>\nHEAD\uff1a<br \/>\n\u5206\u652f\uff1a<br \/>\n\u914d\u7f6e\uff1a\u8bbe\u7f6e\u6587\u4ef6<br \/>\n\u63cf\u8ff0\uff1a<br \/>\n\u6302\u94a9\uff1a<br \/>\n\u4fe1\u606f\uff1a<br \/>\n\u5bf9\u8c61\uff1a\u4ed3\u5e93\u4e3b\u4f53\uff08\u6811\u6587\u4ef6\uff0c\u63d0\u4ea4\u6587\u4ef6\uff09<\/details>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u4ed6\u306e\u4eba\u304c\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u305f\u5834\u5408\u306f\u4ee5\u4e0b\u3092\u884c\u3046<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">git clone &lt;\u30ea\u30dd\u30b8\u30c8\u30ea&gt;\u3067\u30af\u30fc\u30ed\u30f3\u3092\u4f5c\u6210\u3059\u308b\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30ed\u30fc\u30ab\u30eb\u306b\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u30d5\u30a1\u30a4\u30eb\u3068.git\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u30b3\u30d4\u30fc\u3055\u308c\u308b\u3002<\/ul>\n<p>1. \u65b0\u589e\u4e00\u4e2a\u8fdc\u7a0b\u4ed3\u5e93\u3002<br \/>\n\u4f7f\u7528\u547d\u4ee4 git remote add origin<\/p>\n<details>\u4f7f\u7528&#8221;origin&#8221;\u4f5c\u4e3a\u5feb\u6377\u65b9\u5f0f\uff0c\u5c06\u8fdc\u7a0b\u5b58\u50a8\u5e93\u7684URL\u6ce8\u518c\u3002<br \/>\n\u901a\u8fc7\u6ce8\u518c\uff0c\u4ee5\u540e\u53ef\u4ee5\u901a\u8fc7&#8221;origin&#8221;\u540d\u79f0\u5c06\u6587\u4ef6\u4e0a\u4f20\u6216\u4e0b\u8f7d\u5230GitLab\u5b58\u50a8\u5e93\u3002<br \/>\n\u5982\u679c\u4e0d\u6ce8\u518c&#8230;<br \/>\n\u6bcf\u6b21\u90fd\u5fc5\u987b\u624b\u52a8\u8f93\u5165\u5b58\u50a8\u5e93\u7684URL\u3002<\/details>\n<p>\u628a\u6210\u679c\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93<br \/>\ngit push &lt;\u8fdc\u7a0b\u540d\u79f0&gt;&lt;\u5206\u652f\u540d\u79f0&gt;<\/p>\n<p>\u4e0b\u9762\u662f\u6709\u5173Github\u7684\u786e\u8ba4\u4e8b\u9879\uff1a<br \/>\nhttps:\/\/docs.github.com\/ja\/authentication\/keeping-your-account-and-data-secure\/creating-a-personal-access-token<\/p>\n<h2>\u6307\u4ee4\u96c6<\/h2>\n<p>git remote add origin \uff1a\u5c06\u8fdc\u7a0b\u4ed3\u5e93\u6dfb\u52a0\u4e3a\u65b0\u7684\u6ce8\u518c\u3002<\/p>\n<details>\u4f7f\u7528 &#8220;origin&#8221; \u8fd9\u4e2a\u5feb\u6377\u65b9\u5f0f\u6765\u6ce8\u518c\u8fdc\u7a0b\u5b58\u50a8\u5e93\u7684url\u3002<br \/>\n\u6ce8\u518c\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 &#8220;origin&#8221; \u8fd9\u4e2a\u540d\u79f0\u5c06\u6587\u4ef6\u4e0a\u4f20\u6216\u8005\u4eceGitLab\u5b58\u50a8\u5e93\u4e2d\u83b7\u53d6\u3002<br \/>\n\u5982\u679c\u4e0d\u8fdb\u884c\u6ce8\u518c\u7684\u8bdd\uff0c\u6bcf\u6b21\u90fd\u5fc5\u987b\u624b\u52a8\u586b\u5199\u5b58\u50a8\u5e93\u7684url\u3002<\/details>\n<p>git add\uff1a\u5728VS Code\u4e2d\u8fdb\u884c\u5de5\u4f5c\u5e76\u5c06\u5176\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u4e2d\u3002<\/p>\n<p>git commit: \u5c06\u6682\u5b58\u533a\u7684\u5185\u5bb9\u6dfb\u52a0\u5230\u4ed3\u5e93\u4e2d\u3002<br \/>\n\u9009\u9879 -m: \u7f16\u5199\u63d0\u4ea4\u4fe1\u606f\u3002<br \/>\n\u9009\u9879 -v: \u53ef\u4ee5\u67e5\u770b\u7f16\u8f91\u5668\u4e2d\u7684\u66f4\u6539\u5185\u5bb9\u3002<\/p>\n<p>\u63d0\u4ea4\u4fe1\u606f\u7684\u7f16\u5199\u65b9\u5f0f\uff01<br \/>\n\u7b2c\u4e00\u884c\uff1a\u7c7b\u578b\u25a1\u53d8\u66f4\u5185\u5bb9\u7684\u6458\u8981<br \/>\n\u7b2c\u4e8c\u884c\uff1a\u7a7a\u884c<br \/>\n\uff08\u7b2c\u4e09\u884c\uff1a\u53d8\u66f4\u539f\u56e0\uff09<\/p>\n<p>\u4e0b\u9762\u662f\u9009\u62e9\u7c7b\u578b\u7684\u65b9\u5f0f\u2193<br \/>\nhttps:\/\/github.com\/angular\/angular.js\/blob\/master\/DEVELOPERS.md#commit-message-format<\/p>\n<p>\u9009\u62e9\u7c7b\u578b\u7684\u65b9\u6cd5\u5982\u4e0b\u2193<br \/>\nhttps:\/\/github.com\/angular\/angular.js\/blob\/master\/DEVELOPERS.md#commit-message-format<\/p>\n<p>\u4f7f\u7528Git\u547d\u4ee4\u5c06&lt;\u5206\u652f\u540d\u79f0&gt;\u63a8\u9001\u5230&lt;\u8fdc\u7a0b\u540d\u79f0&gt;\uff1a\u5c06\u5185\u5bb9\u53d1\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93<br \/>\n\u4ee5\u4e0b\u662f\u5728GitHub\u4e2d\u9700\u8981\u6ce8\u610f\u7684\u4e8b\u9879\u2193<br \/>\nhttps:\/\/docs.github.com\/ja\/authentication\/keeping-your-account-and-data-secure\/creating-a-personal-access-token<\/p>\n<p>git status\uff1a\u7528\u4e8e\u67e5\u770b\u5728\u5de5\u4f5c\u76ee\u5f55\u548c\u6682\u5b58\u533a\u4e4b\u95f4\u53d1\u751f\u66f4\u6539\u7684\u6587\u4ef6\uff0c\u4ee5\u53ca\u5728\u6682\u5b58\u533a\u548c\u4ed3\u5e93\u4e2d\u53d1\u751f\u66f4\u6539\u7684\u6587\u4ef6\u3002<\/p>\n<p>git diff\uff1a\u7528\u4e8e\u68c0\u67e5\u5de5\u4f5c\u533a\u548c\u6682\u5b58\u533a\u4e4b\u95f4\u7684\u66f4\u6539\u5dee\u5f02<br \/>\ngit diff &lt;\u6587\u4ef6\u540d&gt;\uff1a\u7528\u4e8e\u68c0\u67e5\u7279\u5b9a\u6587\u4ef6\u7684\u66f4\u6539\u5dee\u5f02<br \/>\ngit diff &#8211;staged\uff1a\u7528\u4e8e\u68c0\u67e5\u6682\u5b58\u533a\u548c\u4ed3\u5e93\u4e4b\u95f4\u7684\u66f4\u6539\u5dee\u5f02\uff08\u5dee\u5f02\u7684\u7b80\u79f0\uff09<\/p>\n<p>git log: \u663e\u793a\u63d0\u4ea4\u5386\u53f2\uff0c\u663e\u793a\u63d0\u4ea41\u548c\u63d0\u4ea42\u7684\u66f4\u6539\u5386\u53f2\u3002<\/p>\n<p>git rm &lt;\u6587\u4ef6&gt;\uff1a\u5220\u9664\u6587\u4ef6<br \/>\ngit rm &lt;\u76ee\u5f55&gt;\uff1a\u5220\u9664\u76ee\u5f55<br \/>\ngit rm &#8211;cached &lt;\u6587\u4ef6\u540d&gt;\uff1a\u53ea\u60f3\u4ece\u672c\u5730\u5b58\u50a8\u5e93\u4e2d\u5220\u9664<\/p>\n<p>git reset\uff1a<br \/>\ngit remote -v: \u663e\u793a\u8bbe\u7f6e\u7684\u8fdc\u7a0b\u4ed3\u5e93\u4fe1\u606f<br \/>\ngit remote show &lt;\u8fdc\u7a0b\u540d\u79f0&gt;: \u663e\u793a\u6bd4git remote\u66f4\u8be6\u7ec6\u7684\u4fe1\u606f<br \/>\ngit remote add &lt;\u8fdc\u7a0b\u540d\u79f0&gt; &lt;\u8fdc\u7a0bURL&gt;: \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u8fdc\u7a0b\u4ed3\u5e93\u3002\u53ef\u4ee5\u901a\u8fc7&lt;\u8fdc\u7a0b\u540d\u79f0&gt;\u5c06\u6587\u4ef6\u4e0a\u4f20\u6216\u4e0b\u8f7d\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u5e76\u4e14\u53ef\u4ee5\u6ce8\u518c\u4e24\u4e2a\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u4ee5\u4fbf\u4e2a\u4eba\u548c\u516c\u53f8\u5206\u5f00\u7ba1\u7406\u3002<br \/>\ngit fetch &lt;\u8fdc\u7a0b\u540d\u79f0&gt;: \u4ece\u8fdc\u7a0b\u4ed3\u5e93\u83b7\u53d6\u5206\u652f\u5230\u672c\u5730\u4ed3\u5e93\u3002\u901a\u5e38\u4f7f\u7528fetch\uff01\uff08\u83b7\u53d6\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5185\u5bb9\uff09<\/p>\n<p>git\u5408\u5e76&lt;\u8fdc\u7a0b\u540d\u79f0&gt;\uff1a\u5c06\u672c\u5730\u5b58\u50a8\u5e93\u5408\u5e76\u5230\u5de5\u4f5c\u76ee\u5f55\u4e2d\u3002<br \/>\ngit\u5408\u5e76&lt;\u5206\u652f\u540d\u79f0&gt;\uff1a<br \/>\ngit\u5408\u5e76&lt;\u8fdc\u7a0b\u540d\u79f0\/\u5206\u652f\u540d\u79f0&gt;\uff1a<\/p>\n<p>git checkout &lt;\u5206\u652f\u540d&gt;\uff1a\u5207\u6362\u5206\u652f<br \/>\ngit -a\uff1a\u663e\u793a\u6240\u6709\u5206\u652f<br \/>\ngit pull &lt;\u8fdc\u7a0b\u540d&gt;&lt;\u5206\u652f\u540d&gt;\uff1a\u83b7\u53d6\u5e76\u5408\u5e76<br \/>\n\u4f7f\u7528 fetch \u548c pull \u7684\u533a\u522b\uff1a\u4e00\u822c\u60c5\u51b5\u4e0b\u4f7f\u7528 fetch\uff01<br \/>\ngit remote rename &lt;\u65e7\u8fdc\u7a0b\u540d&gt;&lt;\u65b0\u8fdc\u7a0b\u540d&gt;\uff1a\u91cd\u547d\u540d\u8fdc\u7a0b\u540d<br \/>\ngit remote rm &lt;\u8fdc\u7a0b\u540d&gt;\uff1a\u5220\u9664\u8fdc\u7a0b<\/p>\n<p>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a&lt;\u5206\u652f\u540d\u79f0&gt;\u7684\u5206\u652f\uff08\u4e0d\u5207\u6362\u5230\u8be5\u5206\u652f\uff09<br \/>\n\u663e\u793a\u5206\u652f\u5217\u8868<br \/>\n\u663e\u793a\u6240\u6709\u5206\u652f\uff08\u5305\u62ec\u8fdc\u7a0b\u5206\u652f\uff09<\/p>\n<p>git checkout &lt;\u65e2\u5b58\u5206\u652f&gt;\uff1a\u5207\u6362\u5230\u73b0\u6709\u5206\u652f<br \/>\ngit checkout -b &lt;\u65b0\u5206\u652f&gt;\uff1a\u521b\u5efa\u5e76\u5207\u6362\u5230\u65b0\u5206\u652f<\/p>\n<p>\u5408\u5e76\u5206\u652f&lt;\u30d6\u30e9\u30f3\u30c1\u540d&gt;\uff1a<br \/>\n\u5408\u5e76\u5206\u652f&lt;\u30ea\u30e2\u30fc\u30c8\u540d\/\u30d6\u30e9\u30f3\u30c1\u540d&gt;\uff1a<\/p>\n<p>\u53ea\u9700\u8981\u4e00\u79cd\u9009\u62e9\uff1a<br \/>\ngit branch -m &lt;\u5206\u652f\u540d&gt;\uff1a\u66f4\u6539\u5f53\u524d\u5de5\u4f5c\u5206\u652f\u7684\u540d\u79f0<br \/>\ngit branch -d &lt;\u5206\u652f\u540d&gt;\uff1a\u5220\u9664\u5206\u652f<br \/>\ngit branch -D &lt;\u5206\u652f\u540d&gt;\uff1a\u5f3a\u5236\u5220\u9664\u5206\u652f<\/p>\n<p>\u5c06\u5206\u652f\u7684\u57fa\u51c6\u63d0\u4ea4\u79fb\u52a8\u5230\u53e6\u4e00\u4e2a\u63d0\u4ea4\uff0c\u6539\u53d8\u7236\u5b50\u63d0\u4ea4\u5173\u7cfb\u3002<\/p>\n<p>git stash\uff1a\u5c06\u5de5\u4f5c\u533a\u548c\u6682\u5b58\u533a\u7684\u4fee\u6539\u5b58\u50a8\u5230stash\u4e2d\uff0c\u7136\u540e\u5207\u6362\u5230\u53e6\u4e00\u4e2a\u5206\u652f\uff08stash\u610f\u4e3a\u9690\u85cf\uff09<br \/>\ngit stash list\uff1a\u663e\u793a\u5df2\u5b58\u50a8\u7684\u5de5\u4f5c\u5217\u8868<br \/>\ngit stash apply\uff1a\u6062\u590d\u6700\u65b0\u7684\u5de5\u4f5c<br \/>\ngit stash apply &#8211;index\uff1a\u6062\u590d\u6682\u5b58\u533a\u7684\u72b6\u6001<br \/>\ngit stash drop\uff1a\u5220\u9664\u6700\u65b0\u7684\u5de5\u4f5c<br \/>\ngit stash drop &lt;stash\u540d\u79f0&gt;\uff1a\u5220\u9664\u7279\u5b9a\u7684\u5de5\u4f5c<br \/>\ngit stash clear\uff1a\u5220\u9664\u6240\u6709\u5de5\u4f5c<\/p>\n<p>git diff \uff1a\u67e5\u770b\u5de5\u4f5c\u76ee\u5f55\u4e0e\u6682\u5b58\u533a\u7684\u53d8\u66f4\u5dee\u5f02<br \/>\ngit diff &lt;\u6587\u4ef6\u540d&gt;\uff1a\u67e5\u770b\u7279\u5b9a\u6587\u4ef6\u7684\u53d8\u66f4\u5dee\u5f02<br \/>\ngit diff &#8211;staged \uff1a\u67e5\u770b\u6682\u5b58\u533a\u4e0e\u4ee3\u7801\u4ed3\u5e93\u7684\u53d8\u66f4\u5dee\u5f02\uff08difference\u7684\u7f29\u5199\uff09<\/p>\n<p>\u522a\u9664\u5728\u672c\u5730\u5132\u5b58\u5eab\u4e2d\u7684\u7279\u5b9a\u6a94\u6848\uff0c\u6307\u4ee4\u70ba git rm &#8211;cached &lt;\u6a94\u6848\u540d&gt;\u3002<\/p>\n<p>git\u91cd\u7f6e:<\/p>\n<h2>\u8bcd\u6c47\u8868<\/h2>\n<p>\u5206\u652f\uff1a\u63d0\u4ea4\u540e\uff0c\u6307\u5411\u7684\u63d0\u4ea4\u6587\u4ef6\u5c06\u53d1\u751f\u53d8\u5316\u3002\u5b83\u662f\u4e00\u4e2a\u8bb0\u5f55\u7740\u63d0\u4ea4ID\u7684\u6307\u9488\u3002<br \/>\nHEAD\uff1a\u6307\u5411\u5f53\u524d\u5de5\u4f5c\u4e2d\u7684\u5206\u652f\u7684\u6307\u9488\u3002<br \/>\n\u5408\u5e76\uff1a\u5c06\u5176\u4ed6\u4eba\u7684\u66f4\u6539\u5185\u5bb9\u5408\u5e76\u8fdb\u6765\u7684\u64cd\u4f5c\u3002<\/p>\n<p>\u51b2\u7a81\uff1a\u5728\u540c\u4e00\u6587\u4ef6\u7684\u540c\u4e00\u884c\u4e0a\u8fdb\u884c\u4e0d\u540c\u7f16\u8f91\u65f6\u53d1\u751f\u7684\u60c5\u51b5\u3002<br \/>\n\u62c9\u53d6\u8bf7\u6c42\uff1a<br \/>\n\u8fdc\u7a0b\u5206\u652f\uff1a\u6307\u5411\u8fdc\u7a0b\u5206\u652f\u72b6\u6001\u7684\u6307\u9488\u3002\u4ee5&lt;\u8fdc\u7a0b&gt;\/&lt;\u5206\u652f&gt;\u7684\u5f62\u5f0f\u5f15\u7528\uff08git fetch\uff09\u3002<br \/>\nGitflow\uff1a<br \/>\n\u91cd\u7f6e\uff1a\u5c06\u57fa\u7840\u63d0\u4ea4\u66f4\u65b0\u4e3a\u65b0\u7684\u63d0\u4ea4\u3002<br \/>\n\u6682\u5b58\uff1a\u5f53\u4e0d\u60f3\u5728\u5de5\u4f5c\u4e2d\u95f4\u63d0\u4ea4\u4f46\u9700\u8981\u5728\u53e6\u4e00\u4e2a\u5206\u652f\u4e0a\u5de5\u4f5c\u65f6\uff0c\u8fdb\u884c\u4e34\u65f6\u5b58\u50a8\u3002<\/p>\n<h2>Git\u6d41\u7a0b<\/h2>\n<p>&nbsp;<\/p>\n<p>\u8fdb\u884c\u4e2d<\/p>\n<p>\u901a\u8fc7\u8fdc\u7a0b\u6dfb\u52a0\uff0c\u53ef\u4ee5\u5c06git\u547d\u4ee4\u4e2d\u7684origin\u7528\u4f5c\u540d\u4e3aorigin\u7684\u540d\u79f0\u6765\u4f7f\u7528\u3002<br \/>\n\u901a\u8fc7git branch -M main master\u5c06\u5206\u652f\u66f4\u6539\u4e3amain\u3002<br \/>\n\u901a\u8fc7git push -origin main\u5c06main\u63a8\u9001\u5230origin\uff08\u5df2\u6ce8\u518c\u7684url\uff09\u3002<br \/>\n-u\u9009\u9879\uff1a\u5c06\u6307\u5b9a\u7684\u8fdc\u7a0b\u4ed3\u5e93\u5206\u652f\u8bbe\u7f6e\u4e3a\u4e0a\u6e38\u5206\u652f\u3002<br \/>\n\u901a\u8fc7\u8bbe\u7f6e\u4e3a\u4e0a\u6e38\u5206\u652f\uff0c\u53ef\u4ee5\u5728\u4f7f\u7528git push\u65f6\u7701\u7565\u8fdc\u7a0b\u4ed3\u5e93\u540d\u79f0\u548c\u5206\u652f\u540d\u79f0\u3002<br \/>\n\u5373\u53ea\u9700\u4f7f\u7528git push\u5373\u53ef\u8fdb\u884c\u63a8\u9001\u3002<\/p>\n<p>\u5efa\u7acb\u4e00\u4e2a\u7a7a\u7684\u8fdc\u7a0b\u4ed3\u5e93\u3002<br \/>\n\u5c06\u672c\u5730\u6784\u5efa\u7684\u4ed3\u5e93\u8fdb\u884c\u63a8\u9001\u3002<\/p>\n<p>\u5206\u53c9<br \/>\n\u6d3e\u751f\u529f\u80fd\u4ece\u4e3b\u8981\u529f\u80fd\u6d3e\u751f\u51fa\u6765<br \/>\n\u5206\u53c9\u7684\u539f\u56e0\uff1a<br \/>\n\u4e3b\u8981\u529f\u80fd\u505c\u6b62\u7ef4\u62a4<br \/>\n\u7531\u4e8e\u5f00\u53d1\u65b9\u9488\u7684\u5dee\u5f02\u800c\u5206\u79bb<br \/>\n\u4e0e\u514b\u9686\u7684\u533a\u522b\uff1a<br \/>\n\u5206\u53c9\u540e\u7684\u9875\u9762\u4f1a\u663e\u793a\u539f\u59cb\u5206\u53c9\u6e90<br \/>\n\u53ef\u4ee5\u4ece\u539f\u59cb\u5206\u53c9\u6e90\u8df3\u8f6c\u5230\u5206\u53c9\u540e\u7684\u5b58\u50a8\u5e93<\/p>\n<p>\u62c9\u53d6\u8bf7\u6c42: \u4e3a\u4e86\u5c06\u66f4\u6539\u5408\u5e76\u5230\u9879\u76ee\u4e2d\u800c\u53d1\u51fa\u7684\u8bf7\u6c42\uff08\u62c9\u53d6\u64cd\u4f5c\u7528\u4e8e\u5408\u5e76\u66f4\u6539\uff09\u3002<\/p>\n<p>GitActions\uff1a<br \/>\n\u5728Push\u7b49\u65f6\u673a\u4e0b\uff0c\u53ef\u4ee5\u5728Github\u4e0a\u6267\u884c\u4efb\u610f\u547d\u4ee4<br \/>\n\u5c06\u6784\u5efa\u5e76\u5c06\u6210\u679c\u7269\u81ea\u52a8\u53d1\u5e03\u5230\u7f51\u7ad9<br \/>\n\u6301\u7eed\u96c6\u6210\uff08CI\uff09\uff1a\u81ea\u52a8\u5316\u6d4b\u8bd5<br \/>\n\u6301\u7eed\u4ea4\u4ed8\uff08CD\uff09\uff1a\u81ea\u52a8\u5c06\u6210\u679c\u7269\u90e8\u7f72\u5230\u751f\u4ea7\u73af\u5883<\/p>\n<p>\u5206\u652f\u6a21\u578b\uff1a<br \/>\n1. Git-flow<br \/>\n2. GitHub flow<\/p>\n<p>\u5275\u5efa\u4e00\u500b\u5206\u652f\uff0c\u505a\u4e00\u4e9b\u63d0\u4ea4\uff0c\u7136\u5f8c\u767c\u8d77\u62c9\u53d6\u8acb\u6c42\u3002<br \/>\n\u5728\u5206\u652f\u7684\u62c9\u53d6\u8acb\u6c42\u4e0a\u5c0d\u4ee3\u78bc\u9032\u884c\u8a55\u8ad6\uff0c\u4e26\u6dfb\u52a0\u4e00\u4e9b\u63d0\u4ea4\uff0c\u6700\u5f8c\u9032\u884c\u5408\u4f75\u3002<\/p>\n<p>\u5728\u5bb9\u5668\u4e2d\u5f15\u7528\u4e3b\u673a\u4e0a\u7684\u6587\u4ef6\u6216\u76ee\u5f55<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9488\u5bf9Git\u7684\u521d\u5b66\u8005\u7684\u6587\u7ae0\u3002 \u673a\u5236 Git\u4f7f\u7528\u5feb\u7167\u8fdb\u884c\u8bb0\u5f55\u3002\u672a\u7ecf\u4fee\u6539\u7684\u6587\u4ef6\u5c06\u5728\u4e0b\u4e00\u4e2a\u7248\u672c\u4e2d\u4fdd\u6301\u4e0d\u53d8\u3002 \u901a\u8fc7\u4f7f\u7528\u5feb [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-37319","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5f00\u59cb\u4f7f\u7528Git\u5427\uff01 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5f00\u59cb\u4f7f\u7528git\u5427\uff01\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5f00\u59cb\u4f7f\u7528Git\u5427\uff01\" \/>\n<meta property=\"og:description\" content=\"\u9488\u5bf9Git\u7684\u521d\u5b66\u8005\u7684\u6587\u7ae0\u3002 \u673a\u5236 Git\u4f7f\u7528\u5feb\u7167\u8fdb\u884c\u8bb0\u5f55\u3002\u672a\u7ecf\u4fee\u6539\u7684\u6587\u4ef6\u5c06\u5728\u4e0b\u4e00\u4e2a\u7248\u672c\u4e2d\u4fdd\u6301\u4e0d\u53d8\u3002 \u901a\u8fc7\u4f7f\u7528\u5feb [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5f00\u59cb\u4f7f\u7528git\u5427\uff01\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-02T11:27:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-28T18:15:55+00:00\" \/>\n<meta name=\"author\" content=\"\u5b87, \u534e\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u5b87, \u534e\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/\",\"name\":\"\u5f00\u59cb\u4f7f\u7528Git\u5427\uff01 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-07-02T11:27:36+00:00\",\"dateModified\":\"2024-04-28T18:15:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5f00\u59cb\u4f7f\u7528Git\u5427\uff01\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458\",\"name\":\"\u5b87, \u534e\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g\",\"caption\":\"\u5b87, \u534e\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yuhua\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5f00\u59cb\u4f7f\u7528Git\u5427\uff01 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u5f00\u59cb\u4f7f\u7528git\u5427\uff01\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5f00\u59cb\u4f7f\u7528Git\u5427\uff01","og_description":"\u9488\u5bf9Git\u7684\u521d\u5b66\u8005\u7684\u6587\u7ae0\u3002 \u673a\u5236 Git\u4f7f\u7528\u5feb\u7167\u8fdb\u884c\u8bb0\u5f55\u3002\u672a\u7ecf\u4fee\u6539\u7684\u6587\u4ef6\u5c06\u5728\u4e0b\u4e00\u4e2a\u7248\u672c\u4e2d\u4fdd\u6301\u4e0d\u53d8\u3002 \u901a\u8fc7\u4f7f\u7528\u5feb [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5f00\u59cb\u4f7f\u7528git\u5427\uff01\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-07-02T11:27:36+00:00","article_modified_time":"2024-04-28T18:15:55+00:00","author":"\u5b87, \u534e","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u5b87, \u534e","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/","name":"\u5f00\u59cb\u4f7f\u7528Git\u5427\uff01 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-07-02T11:27:36+00:00","dateModified":"2024-04-28T18:15:55+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u5f00\u59cb\u4f7f\u7528Git\u5427\uff01"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458","name":"\u5b87, \u534e","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g","caption":"\u5b87, \u534e"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yuhua\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8git%e5%90%a7%ef%bc%81\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=37319"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37319\/revisions"}],"predecessor-version":[{"id":74341,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/37319\/revisions\/74341"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=37319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=37319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=37319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}