{"id":1853,"date":"2017-08-25T13:44:42","date_gmt":"2017-08-25T05:44:42","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=1853"},"modified":"2017-08-25T13:44:42","modified_gmt":"2017-08-25T05:44:42","slug":"git%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=1853","title":{"rendered":"Git\u5e38\u7528\u547d\u4ee4\u603b\u7ed3"},"content":{"rendered":"<p>\n\t\u5927\u90e8\u5206\u7684\u5e73\u5e38\u5f00\u53d1\u4e2d\u53ef\u80fd\u7528\u7684\u90fd\u662f <a href=\"https:\/\/tortoisesvn.net\/\" name=\"tortoisesvn\" target=\"_blank\" title=\"tortoisesvn\">SVN<\/a>\uff0c\u6216 <a href=\"https:\/\/baike.baidu.com\/item\/CVS\" name=\"CVS\" target=\"_blank\" title=\"CVS\">CVS<\/a> \u7b49\u7248\u672c\u63a7\u5236\u5de5\u5177\u3002\u4f46\u662f\u968f\u7740 <a href=\"https:\/\/git-scm.com\/\" name=\"git\" target=\"_blank\" title=\"git\">git<\/a> \u7684\u706b\u70ed\uff0c\u6211\u4eec\u5f88\u6709\u5fc5\u8981\u5b66\u4f1a\u4f7f\u7528\u5b83\u3002\n<\/p>\n<p>\n\t\u5e73\u5e38\u4f7f\u7528 git\uff0c\u5927\u6982\u8bb0\u4f4f8\u4e2a\u547d\u4ee4\u5c31\u53ef\u4ee5\u4e86\u3002\u4f46\u662f\u60f3\u6df1\u5165\u4e00\u4e9b\u6700\u5c11\u9700\u8981\u719f\u608960~100\u4e2a\u547d\u4ee4\u3002\n<\/p>\n<p>\n\tgit \u5e76\u4e0d\u96be\uff0c\u96be\u5728\u4f60\u4e0d\u7406\u89e3\u3002\u540c\u65f6\u8fc7\u591a\u7684\u547d\u4ee4\u4f60\u4e5f\u6ca1\u8bb0\u4f4f\u3002\u5982\u679c\u4f60\u53ea\u662f\u60f3\u5f00\u6e90\u4f60\u7684\u9879\u76ee\u5230 <a href=\"https:\/\/github.com\" name=\"github\" target=\"_blank\" title=\"github\">github<\/a>\uff0c\u5219\u53ef\u4ee5\u53c2\u8003\u6211\u7684\u8fd9\u7bc7\u6587\u7ae0\u300a<a href=\"https:\/\/www.xttblog.com\/?p=1810\" name=\"8\u884c\u4ee3\u7801\u6559\u4f60\u5b66\u4f1a\u81ea\u5efagithub\u5f00\u6e90\u9879\u76ee\" target=\"_blank\" title=\"8\u884c\u4ee3\u7801\u6559\u4f60\u5b66\u4f1a\u81ea\u5efagithub\u5f00\u6e90\u9879\u76ee\">8\u884c\u4ee3\u7801\u6559\u4f60\u5b66\u4f1a\u81ea\u5efagithub\u5f00\u6e90\u9879\u76ee<\/a>\u300b\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"Git\u5e38\u7528\u547d\u4ee4\u901f\u67e5\u8868\" src=\"http:\/\/img.bbs.csdn.net\/upload\/201708\/25\/1503638132_886663.png\" style=\"width: 1240px;height: 816px\" \/>\n<\/p>\n<p>\n\t\u4e0a\u56fe\u662f\u7f51\u4e0a\u7684\u4e00\u5f20 Git \u5e38\u7528\u547d\u4ee4\u901f\u67e5\u8868\u3002\u6db5\u76d6\u4e86\u5e73\u65f6\u4f7f\u7528\u7684\u6240\u6709\u547d\u4ee4\u3002\n<\/p>\n<p>\n\t\u4e0b\u9762\u5217\u4e3e\u4e86\u4e00\u4e9b\u5e38\u7528\u7684 Git \u547d\u4ee4\u3002\n<\/p>\n<h2>\n\tGit \u65b0\u5efa\u4ee3\u7801\u5e93<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\n# \u5728\u5f53\u524d\u76ee\u5f55\u65b0\u5efa\u4e00\u4e2aGit\u4ee3\u7801\u5e93\r\n$ git init\r\n# \u65b0\u5efa\u4e00\u4e2a\u76ee\u5f55\uff0c\u5c06\u5176\u521d\u59cb\u5316\u4e3aGit\u4ee3\u7801\u5e93\r\n$ git init [project-name]\r\n# \u4e0b\u8f7d\u4e00\u4e2a\u9879\u76ee\u548c\u5b83\u7684\u6574\u4e2a\u4ee3\u7801\u5386\u53f2\r\n$ git clone [url]<\/pre>\n<h2>\n\tGit \u914d\u7f6e\u547d\u4ee4<br \/>\n<\/h2>\n<p>\n\tGit\u7684\u8bbe\u7f6e\u6587\u4ef6\u4e3a.gitconfig\uff0c\u5b83\u53ef\u4ee5\u5728\u7528\u6237\u4e3b\u76ee\u5f55\u4e0b\uff08\u5168\u5c40\u914d\u7f6e\uff09\uff0c\u4e5f\u53ef\u4ee5\u5728\u9879\u76ee\u76ee\u5f55\u4e0b\uff08\u9879\u76ee\u914d\u7f6e\uff09\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n# \u663e\u793a\u5f53\u524d\u7684Git\u914d\u7f6e\r\n$ git config --list\r\n# \u7f16\u8f91Git\u914d\u7f6e\u6587\u4ef6\r\n$ git config -e [--global]\r\n# \u8bbe\u7f6e\u63d0\u4ea4\u4ee3\u7801\u65f6\u7684\u7528\u6237\u4fe1\u606f\r\n$ git config [--global] user.name \"[name]&quot;\r\n$ git config [--global] user.email \"[email address]&quot;<\/pre>\n<h2>\n\tGit \u589e\u52a0\/\u5220\u9664\u6587\u4ef6\u547d\u4ee4<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\n# \u6dfb\u52a0\u6307\u5b9a\u6587\u4ef6\u5230\u6682\u5b58\u533a\r\n$ git add [file1] [file2] ...\r\n# \u6dfb\u52a0\u6307\u5b9a\u76ee\u5f55\u5230\u6682\u5b58\u533a\uff0c\u5305\u62ec\u5b50\u76ee\u5f55\r\n$ git add [dir]\r\n# \u6dfb\u52a0\u5f53\u524d\u76ee\u5f55\u7684\u6240\u6709\u6587\u4ef6\u5230\u6682\u5b58\u533a\r\n$ git add .\r\n# \u6dfb\u52a0\u6bcf\u4e2a\u53d8\u5316\u524d\uff0c\u90fd\u4f1a\u8981\u6c42\u786e\u8ba4\r\n# \u5bf9\u4e8e\u540c\u4e00\u4e2a\u6587\u4ef6\u7684\u591a\u5904\u53d8\u5316\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5206\u6b21\u63d0\u4ea4\r\n$ git add -p\r\n# \u5220\u9664\u5de5\u4f5c\u533a\u6587\u4ef6\uff0c\u5e76\u4e14\u5c06\u8fd9\u6b21\u5220\u9664\u653e\u5165\u6682\u5b58\u533a\r\n$ git rm [file1] [file2] ...\r\n# \u505c\u6b62\u8ffd\u8e2a\u6307\u5b9a\u6587\u4ef6\uff0c\u4f46\u8be5\u6587\u4ef6\u4f1a\u4fdd\u7559\u5728\u5de5\u4f5c\u533a\r\n$ git rm --cached [file]\r\n# \u6539\u540d\u6587\u4ef6\uff0c\u5e76\u4e14\u5c06\u8fd9\u4e2a\u6539\u540d\u653e\u5165\u6682\u5b58\u533a\r\n$ git mv [file-original] [file-renamed]<\/pre>\n<h2>\n\tGit \u63d0\u4ea4\u4ee3\u7801<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\n# \u63d0\u4ea4\u6682\u5b58\u533a\u5230\u4ed3\u5e93\u533a\r\n$ git commit -m [message]\r\n# \u63d0\u4ea4\u6682\u5b58\u533a\u7684\u6307\u5b9a\u6587\u4ef6\u5230\u4ed3\u5e93\u533a\r\n$ git commit [file1] [file2] ... -m [message]\r\n# \u63d0\u4ea4\u5de5\u4f5c\u533a\u81ea\u4e0a\u6b21commit\u4e4b\u540e\u7684\u53d8\u5316\uff0c\u76f4\u63a5\u5230\u4ed3\u5e93\u533a\r\n$ git commit -a\r\n# \u63d0\u4ea4\u65f6\u663e\u793a\u6240\u6709diff\u4fe1\u606f\r\n$ git commit -v\r\n# \u4f7f\u7528\u4e00\u6b21\u65b0\u7684commit\uff0c\u66ff\u4ee3\u4e0a\u4e00\u6b21\u63d0\u4ea4\r\n# \u5982\u679c\u4ee3\u7801\u6ca1\u6709\u4efb\u4f55\u65b0\u53d8\u5316\uff0c\u5219\u7528\u6765\u6539\u5199\u4e0a\u4e00\u6b21commit\u7684\u63d0\u4ea4\u4fe1\u606f\r\n$ git commit --amend -m [message]\r\n# \u91cd\u505a\u4e0a\u4e00\u6b21commit\uff0c\u5e76\u5305\u62ec\u6307\u5b9a\u6587\u4ef6\u7684\u65b0\u53d8\u5316\r\n$ git commit --amend [file1] [file2] ...<\/pre>\n<h2>\n\tGit \u521b\u5efa\u5206\u652f<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\n# \u5217\u51fa\u6240\u6709\u672c\u5730\u5206\u652f\r\n$ git branch\r\n# \u5217\u51fa\u6240\u6709\u8fdc\u7a0b\u5206\u652f\r\n$ git branch -r\r\n# \u5217\u51fa\u6240\u6709\u672c\u5730\u5206\u652f\u548c\u8fdc\u7a0b\u5206\u652f\r\n$ git branch -a\r\n# \u65b0\u5efa\u4e00\u4e2a\u5206\u652f\uff0c\u4f46\u4f9d\u7136\u505c\u7559\u5728\u5f53\u524d\u5206\u652f\r\n$ git branch [branch-name]\r\n# \u65b0\u5efa\u4e00\u4e2a\u5206\u652f\uff0c\u5e76\u5207\u6362\u5230\u8be5\u5206\u652f\r\n$ git checkout -b [branch]\r\n# \u65b0\u5efa\u4e00\u4e2a\u5206\u652f\uff0c\u6307\u5411\u6307\u5b9acommit\r\n$ git branch [branch] [commit]\r\n# \u65b0\u5efa\u4e00\u4e2a\u5206\u652f\uff0c\u4e0e\u6307\u5b9a\u7684\u8fdc\u7a0b\u5206\u652f\u5efa\u7acb\u8ffd\u8e2a\u5173\u7cfb\r\n$ git branch --track [branch] [remote-branch]\r\n# \u5207\u6362\u5230\u6307\u5b9a\u5206\u652f\uff0c\u5e76\u66f4\u65b0\u5de5\u4f5c\u533a\r\n$ git checkout [branch-name]\r\n# \u5207\u6362\u5230\u4e0a\u4e00\u4e2a\u5206\u652f\r\n$ git checkout -\r\n# \u5efa\u7acb\u8ffd\u8e2a\u5173\u7cfb\uff0c\u5728\u73b0\u6709\u5206\u652f\u4e0e\u6307\u5b9a\u7684\u8fdc\u7a0b\u5206\u652f\u4e4b\u95f4\r\n$ git branch --set-upstream [branch] [remote-branch]\r\n# \u5408\u5e76\u6307\u5b9a\u5206\u652f\u5230\u5f53\u524d\u5206\u652f\r\n$ git merge [branch]\r\n# \u9009\u62e9\u4e00\u4e2acommit\uff0c\u5408\u5e76\u8fdb\u5f53\u524d\u5206\u652f\r\n$ git cherry-pick [commit]\r\n# \u5220\u9664\u5206\u652f\r\n$ git branch -d [branch-name]\r\n# \u5220\u9664\u8fdc\u7a0b\u5206\u652f\r\n$ git push origin --delete [branch-name]\r\n$ git branch -dr [remote\/branch]<\/pre>\n<h2>\n\tGit \u6807\u7b7e\u76f8\u5173\u547d\u4ee4<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\n# \u5217\u51fa\u6240\u6709tag\r\n$ git tag\r\n# \u65b0\u5efa\u4e00\u4e2atag\u5728\u5f53\u524dcommit\r\n$ git tag [tag]\r\n# \u65b0\u5efa\u4e00\u4e2atag\u5728\u6307\u5b9acommit\r\n$ git tag [tag] [commit]\r\n# \u5220\u9664\u672c\u5730tag\r\n$ git tag -d [tag]\r\n# \u5220\u9664\u8fdc\u7a0btag\r\n$ git push origin :refs\/tags\/[tagName]\r\n# \u67e5\u770btag\u4fe1\u606f\r\n$ git show [tag]\r\n# \u63d0\u4ea4\u6307\u5b9atag\r\n$ git push [remote] [tag]\r\n# \u63d0\u4ea4\u6240\u6709tag\r\n$ git push [remote] --tags\r\n# \u65b0\u5efa\u4e00\u4e2a\u5206\u652f\uff0c\u6307\u5411\u67d0\u4e2atag\r\n$ git checkout -b [branch] [tag]<\/pre>\n<h2>\n\tGit \u72b6\u6001\u548c\u65e5\u5fd7\u547d\u4ee4<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\n# \u663e\u793a\u6709\u53d8\u66f4\u7684\u6587\u4ef6\r\n$ git status\r\n# \u663e\u793a\u5f53\u524d\u5206\u652f\u7684\u7248\u672c\u5386\u53f2\r\n$ git log\r\n# \u663e\u793acommit\u5386\u53f2\uff0c\u4ee5\u53ca\u6bcf\u6b21commit\u53d1\u751f\u53d8\u66f4\u7684\u6587\u4ef6\r\n$ git log --stat\r\n# \u641c\u7d22\u63d0\u4ea4\u5386\u53f2\uff0c\u6839\u636e\u5173\u952e\u8bcd\r\n$ git log -S [keyword]\r\n# \u663e\u793a\u67d0\u4e2acommit\u4e4b\u540e\u7684\u6240\u6709\u53d8\u52a8\uff0c\u6bcf\u4e2acommit\u5360\u636e\u4e00\u884c\r\n$ git log [tag] HEAD --pretty=format:%s\r\n# \u663e\u793a\u67d0\u4e2acommit\u4e4b\u540e\u7684\u6240\u6709\u53d8\u52a8\uff0c\u5176&quot;\u63d0\u4ea4\u8bf4\u660e&quot;\u5fc5\u987b\u7b26\u5408\u641c\u7d22\u6761\u4ef6\r\n$ git log [tag] HEAD --grep feature\r\n# \u663e\u793a\u67d0\u4e2a\u6587\u4ef6\u7684\u7248\u672c\u5386\u53f2\uff0c\u5305\u62ec\u6587\u4ef6\u6539\u540d\r\n$ git log --follow [file]\r\n$ git whatchanged [file]\r\n# \u663e\u793a\u6307\u5b9a\u6587\u4ef6\u76f8\u5173\u7684\u6bcf\u4e00\u6b21diff\r\n$ git log -p [file]\r\n# \u663e\u793a\u8fc7\u53bb5\u6b21\u63d0\u4ea4\r\n$ git log -5 --pretty --oneline\r\n# \u663e\u793a\u6240\u6709\u63d0\u4ea4\u8fc7\u7684\u7528\u6237\uff0c\u6309\u63d0\u4ea4\u6b21\u6570\u6392\u5e8f\r\n$ git shortlog -sn\r\n# \u663e\u793a\u6307\u5b9a\u6587\u4ef6\u662f\u4ec0\u4e48\u4eba\u5728\u4ec0\u4e48\u65f6\u95f4\u4fee\u6539\u8fc7\r\n$ git blame [file]\r\n# \u663e\u793a\u6682\u5b58\u533a\u548c\u5de5\u4f5c\u533a\u7684\u5dee\u5f02\r\n$ git diff\r\n# \u663e\u793a\u6682\u5b58\u533a\u548c\u4e0a\u4e00\u4e2acommit\u7684\u5dee\u5f02\r\n$ git diff --cached [file]\r\n# \u663e\u793a\u5de5\u4f5c\u533a\u4e0e\u5f53\u524d\u5206\u652f\u6700\u65b0commit\u4e4b\u95f4\u7684\u5dee\u5f02\r\n$ git diff HEAD\r\n# \u663e\u793a\u4e24\u6b21\u63d0\u4ea4\u4e4b\u95f4\u7684\u5dee\u5f02\r\n$ git diff [first-branch]...[second-branch]\r\n# \u663e\u793a\u4eca\u5929\u4f60\u5199\u4e86\u591a\u5c11\u884c\u4ee3\u7801\r\n$ git diff --shortstat &quot;@{0 day ago}&quot;\r\n# \u663e\u793a\u67d0\u6b21\u63d0\u4ea4\u7684\u5143\u6570\u636e\u548c\u5185\u5bb9\u53d8\u5316\r\n$ git show [commit]\r\n# \u663e\u793a\u67d0\u6b21\u63d0\u4ea4\u53d1\u751f\u53d8\u5316\u7684\u6587\u4ef6\r\n$ git show --name-only [commit]\r\n# \u663e\u793a\u67d0\u6b21\u63d0\u4ea4\u65f6\uff0c\u67d0\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\r\n$ git show [commit]:[filename]\r\n# \u663e\u793a\u5f53\u524d\u5206\u652f\u7684\u6700\u8fd1\u51e0\u6b21\u63d0\u4ea4\r\n$ git reflog<\/pre>\n<h2>\n\tGit \u540c\u6b65\u6587\u4ef6\u547d\u4ee4<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\n# \u4e0b\u8f7d\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6240\u6709\u53d8\u52a8\r\n$ git fetch [remote]\r\n# \u663e\u793a\u6240\u6709\u8fdc\u7a0b\u4ed3\u5e93\r\n$ git remote -v\r\n# \u663e\u793a\u67d0\u4e2a\u8fdc\u7a0b\u4ed3\u5e93\u7684\u4fe1\u606f\r\n$ git remote show [remote]\r\n# \u589e\u52a0\u4e00\u4e2a\u65b0\u7684\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u5e76\u547d\u540d\r\n$ git remote add [shortname] [url]\r\n# \u53d6\u56de\u8fdc\u7a0b\u4ed3\u5e93\u7684\u53d8\u5316\uff0c\u5e76\u4e0e\u672c\u5730\u5206\u652f\u5408\u5e76\r\n$ git pull [remote] [branch]\r\n# \u4e0a\u4f20\u672c\u5730\u6307\u5b9a\u5206\u652f\u5230\u8fdc\u7a0b\u4ed3\u5e93\r\n$ git push [remote] [branch]\r\n# \u5f3a\u884c\u63a8\u9001\u5f53\u524d\u5206\u652f\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u5373\u4f7f\u6709\u51b2\u7a81\r\n$ git push [remote] --force\r\n# \u63a8\u9001\u6240\u6709\u5206\u652f\u5230\u8fdc\u7a0b\u4ed3\u5e93\r\n$ git push [remote] --all<\/pre>\n<h2>\n\tGit \u64a4\u9500<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\n# \u6062\u590d\u6682\u5b58\u533a\u7684\u6307\u5b9a\u6587\u4ef6\u5230\u5de5\u4f5c\u533a\r\n$ git checkout [file]\r\n# \u6062\u590d\u67d0\u4e2acommit\u7684\u6307\u5b9a\u6587\u4ef6\u5230\u6682\u5b58\u533a\u548c\u5de5\u4f5c\u533a\r\n$ git checkout [commit] [file]\r\n# \u6062\u590d\u6682\u5b58\u533a\u7684\u6240\u6709\u6587\u4ef6\u5230\u5de5\u4f5c\u533a\r\n$ git checkout .\r\n# \u91cd\u7f6e\u6682\u5b58\u533a\u7684\u6307\u5b9a\u6587\u4ef6\uff0c\u4e0e\u4e0a\u4e00\u6b21commit\u4fdd\u6301\u4e00\u81f4\uff0c\u4f46\u5de5\u4f5c\u533a\u4e0d\u53d8\r\n$ git reset [file]\r\n# \u91cd\u7f6e\u6682\u5b58\u533a\u4e0e\u5de5\u4f5c\u533a\uff0c\u4e0e\u4e0a\u4e00\u6b21commit\u4fdd\u6301\u4e00\u81f4\r\n$ git reset --hard\r\n# \u91cd\u7f6e\u5f53\u524d\u5206\u652f\u7684\u6307\u9488\u4e3a\u6307\u5b9acommit\uff0c\u540c\u65f6\u91cd\u7f6e\u6682\u5b58\u533a\uff0c\u4f46\u5de5\u4f5c\u533a\u4e0d\u53d8\r\n$ git reset [commit]\r\n# \u91cd\u7f6e\u5f53\u524d\u5206\u652f\u7684HEAD\u4e3a\u6307\u5b9acommit\uff0c\u540c\u65f6\u91cd\u7f6e\u6682\u5b58\u533a\u548c\u5de5\u4f5c\u533a\uff0c\u4e0e\u6307\u5b9acommit\u4e00\u81f4\r\n$ git reset --hard [commit]\r\n# \u91cd\u7f6e\u5f53\u524dHEAD\u4e3a\u6307\u5b9acommit\uff0c\u4f46\u4fdd\u6301\u6682\u5b58\u533a\u548c\u5de5\u4f5c\u533a\u4e0d\u53d8\r\n$ git reset --keep [commit]\r\n# \u65b0\u5efa\u4e00\u4e2acommit\uff0c\u7528\u6765\u64a4\u9500\u6307\u5b9acommit\r\n# \u540e\u8005\u7684\u6240\u6709\u53d8\u5316\u90fd\u5c06\u88ab\u524d\u8005\u62b5\u6d88\uff0c\u5e76\u4e14\u5e94\u7528\u5230\u5f53\u524d\u5206\u652f\r\n$ git revert [commit]\r\n# \u6682\u65f6\u5c06\u672a\u63d0\u4ea4\u7684\u53d8\u5316\u79fb\u9664\uff0c\u7a0d\u540e\u518d\u79fb\u5165\r\n$ git stash\r\n$ git stash pop<\/pre>\n<h2>\n\tGit \u514b\u9686\u4ed3\u5e93\u547d\u4ee4<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\ngit clone git:\/\/github.com\/yanhaijing\/data.js.git\t\r\ngit clone git:\/\/github.com\/schacon\/grit.git mypro#\u514b\u9686\u5230\u81ea\u5b9a\u4e49\u6587\u4ef6\u5939<\/pre>\n<h2>\n\tGit \u5206\u652f\u5408\u5e76\u547d\u4ee4<br \/>\n<\/h2>\n<pre class=\"brush:bash;\">\r\ngit branch#\u5217\u51fa\u672c\u5730\u5206\u652f\r\ngit branch -r#\u5217\u51fa\u8fdc\u7aef\u5206\u652f\r\ngit branch -a#\u5217\u51fa\u6240\u6709\u5206\u652f\r\ngit branch -v#\u67e5\u770b\u5404\u4e2a\u5206\u652f\u6700\u540e\u4e00\u4e2a\u63d0\u4ea4\u5bf9\u8c61\u7684\u4fe1\u606f\r\ngit branch --merge#\u67e5\u770b\u5df2\u7ecf\u5408\u5e76\u5230\u5f53\u524d\u5206\u652f\u7684\u5206\u652f\r\ngit branch --no-merge#\u67e5\u770b\u4e3a\u5408\u5e76\u5230\u5f53\u524d\u5206\u652f\u7684\u5206\u652f\r\ngit branch test#\u65b0\u5efatest\u5206\u652f\r\ngit branch branch [branch|commit|tag] # \u4ece\u6307\u5b9a\u4f4d\u7f6e\u51fa\u65b0\u5efa\u5206\u652f\r\ngit branch --track branch remote-branch # \u65b0\u5efa\u4e00\u4e2a\u5206\u652f\uff0c\u4e0e\u6307\u5b9a\u7684\u8fdc\u7a0b\u5206\u652f\u5efa\u7acb\u8ffd\u8e2a\u5173\u7cfb\r\ngit branch -m old new #\u91cd\u547d\u540d\u5206\u652f\r\ngit branch -d test#\u5220\u9664test\u5206\u652f\r\ngit branch -D test#\u5f3a\u5236\u5220\u9664test\u5206\u652f\r\ngit branch --set-upstream dev origin\/dev #\u5c06\u672c\u5730dev\u5206\u652f\u4e0e\u8fdc\u7a0bdev\u5206\u652f\u4e4b\u95f4\u5efa\u7acb\u94fe\u63a5\r\ngit checkout test#\u5207\u6362\u5230test\u5206\u652f\r\ngit checkout -b test#\u65b0\u5efa+\u5207\u6362\u5230test\u5206\u652f\r\ngit checkout -b test dev#\u57fa\u4e8edev\u65b0\u5efatest\u5206\u652f\uff0c\u5e76\u5207\u6362\r\ngit merge test#\u5c06test\u5206\u652f\u5408\u5e76\u5230\u5f53\u524d\u5206\u652f\r\ngit merge --squash test ## \u5408\u5e76\u538b\u7f29\uff0c\u5c06test\u4e0a\u7684commit\u538b\u7f29\u4e3a\u4e00\u6761\r\ngit cherry-pick commit #\u62e3\u9009\u5408\u5e76\uff0c\u5c06commit\u5408\u5e76\u5230\u5f53\u524d\u5206\u652f\r\ngit cherry-pick -n commit #\u62e3\u9009\u591a\u4e2a\u63d0\u4ea4\uff0c\u5408\u5e76\u5b8c\u540e\u53ef\u4ee5\u7ee7\u7eed\u62e3\u9009\u4e0b\u4e00\u4e2a\u63d0\u4ea4\r\ngit rebase master#\u5c06master\u5206\u4e4b\u4e0a\u8d85\u524d\u7684\u63d0\u4ea4\uff0c\u53d8\u57fa\u5230\u5f53\u524d\u5206\u652f\r\ngit rebase --onto master 169a6 #\u9650\u5236\u56de\u6eda\u8303\u56f4\uff0crebase\u5f53\u524d\u5206\u652f\u4ece169a6\u4ee5\u540e\u7684\u63d0\u4ea4\r\ngit rebase --interactive #\u4ea4\u4e92\u6a21\u5f0f\t\r\ngit rebase --continue# \u5904\u7406\u5b8c\u51b2\u7a81\u7ee7\u7eed\u5408\u5e76\t\r\ngit rebase --skip# \u8df3\u8fc7\t\r\ngit rebase --abort# \u53d6\u6d88\u5408\u5e76<\/pre>\n<p>\n\t\u4ee5\u4e0a git \u76f8\u5173\u547d\u4ee4\uff0c\u4f60\u5b8c\u5168\u638c\u63e1\u5c31\u662f\u5927\u725b\u7ea7\u522b\u7684\u4e86\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=1853\">Git\u5e38\u7528\u547d\u4ee4\u603b\u7ed3<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u5927\u90e8\u5206\u7684\u5e73\u5e38\u5f00\u53d1\u4e2d\u53ef\u80fd\u7528\u7684\u90fd\u662f SVN\uff0c\u6216 CVS \u7b49\u7248\u672c\u63a7\u5236\u5de5\u5177\u3002\u4f46\u662f\u968f\u7740 git \u7684\u706b\u70ed\uff0c\u6211\u4eec\u5f88\u6709\u5fc5\u8981\u5b66\u4f1a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[118],"tags":[1438,1461,1459,1460,1458],"class_list":["post-1853","post","type-post","status-publish","format-standard","hentry","category-ndisdevelop","tag-git","tag-git-fresh","tag-git-"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1853"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1853\/revisions"}],"predecessor-version":[{"id":1854,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1853\/revisions\/1854"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}