
{"id":2821,"date":"2020-12-24T10:16:03","date_gmt":"2020-12-24T02:16:03","guid":{"rendered":"http:\/\/127.0.0.2\/?p=2821"},"modified":"2020-12-24T11:13:54","modified_gmt":"2020-12-24T03:13:54","slug":"2020%e6%9c%80%e6%96%b0%e7%89%88git%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.9713job.com\/?p=2821","title":{"rendered":"2020\u6700\u65b0\u7248Git\u6559\u7a0b"},"content":{"rendered":"<h3>2020\u6700\u65b0\u7248Git\u6559\u7a0b<\/h3>\n<p><strong>git\u5b89\u88c5\u4ee5\u53ca\u521d\u59cb\u5316<\/strong><\/p>\n<p>\u67e5\u770bgit\u7248\u672c\uff1agit &#8211;version<br \/>\n\u8bbe\u7f6e\u7528\u6237\u540d\uff1agit config &#8211;global user.name &#8220;Your Name&#8221;<br \/>\n\u8bbe\u7f6e\u90ae\u7bb1\uff1agit config &#8211;global user.email &#8220;email@example.com&#8221;<br \/>\n\u67e5\u770b\u4fe1\u606f\uff1agit config -l<\/p>\n<p><strong>git\u4ed3\u5e93<\/strong><\/p>\n<p>\u521b\u5efa\u4ed3\u5e93\uff0c\u5728\u672c\u5730\u78c1\u76d8\u521b\u5efa\u4e2a\u6587\u4ef6\u5939\uff0c\u7136\u540e\u6253\u5f00cmd\uff0c\u8f93\u5165\uff1agit init<\/p>\n<p><strong>git\u57fa\u672c\u64cd\u4f5c<\/strong><\/p>\n<p><!--more--><\/p>\n<p>\u67e5\u770b\u5de5\u4f5c\u533a\u72b6\u6001\uff1agit status<\/p>\n<p>\u6587\u4ef6\u4e0a\u4f20\u5230\u6682\u5b58\u533a\uff1agit add .<\/p>\n<p>\u6587\u4ef6\u63d0\u4ea4\uff1agit commit -m &#8220;info&#8221;<\/p>\n<p><strong>git\u8fdc\u7a0b\u4ed3\u5e93<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/1.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u4e0a\u4f20\u5230\u54ea\u4e2a\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740\uff1agit remote add origin url<\/p>\n<p>\u67e5\u770b\u5173\u8054\u7684\u5730\u5740\uff1agit remote -v<\/p>\n<p>\u5c06\u672c\u5730\u4ed3\u5e93\u6587\u4ef6\u4e0a\u4f20\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\uff1agit push origin master<\/p>\n<p>\u7136\u540e\u5f39\u7a97\u767b\u5f55\uff0c\u8f93\u5165\u8d26\u53f7\u548c\u5bc6\u7801<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/2.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>git\u514b\u9686\u8fdc\u7a0b\u4ed3\u5e93<\/strong><\/p>\n<p>git\u514b\u9686\u8fdc\u7a0b\u4ed3\u5e93\u5230\u672c\u5730\uff1agit clone url<\/p>\n<p>git\u8fdc\u7a0b\u4ed3\u5e93\u66f4\u65b0\u5230\u672c\u5730\u4ed3\u5e93\uff1agit pull<\/p>\n<p><strong>git\u5206\u652f<\/strong><\/p>\n<p>\u67e5\u770b\u5206\u652f\uff1agit branch<\/p>\n<p>\u521b\u5efa\u5206\u652f\uff1agit branch v1<\/p>\n<p>\u5207\u6362\u5206\u652f\uff1agit\u00a0 checkout master<\/p>\n<p><strong>\u5206\u652f\u63d0\u4ea4\u65e5\u5fd7<\/strong><\/p>\n<p>\u7b80\u5355\u65e5\u5fd7\uff1agit log &#8211;oneline<\/p>\n<p>\u5b8c\u6574\u65e5\u5fd7\uff1agit log<\/p>\n<p>\u56fe\u5f62\u65e5\u5fd7\uff1agit log &#8211;oneline &#8211;graph<\/p>\n<p><strong>\u5206\u4e4b\u5408\u5e76<\/strong><\/p>\n<p><strong>\u5feb\u901f\u5408\u5e76<\/strong>\uff1agit merge master<\/p>\n<p>\u5982\u679c\u5206\u652fA\u5f53\u524d\u7684\u4fee\u6539\uff0c\u662f\u5b8c\u5168\u57fa\u4e8e\u5206\u652fB\u7684\u4fee\u6539\u800c\u6765\uff0c\u5219B\u5206\u652f\u5408\u5e76A\u5206\u652f\uff0c\u5c31\u662f\u6709\u79fb\u52a8\u6307\u9488\u5373\u53ef\u3002<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/3.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>\u4e09\u65b9\u5408\u5e76<\/strong><\/p>\n<p>\u5728\u4e0d\u5177\u5907\u5feb\u901f\u5408\u5e76\u7684\u6761\u4ef6\u4e0b\uff0c\u4f1a\u91c7\u7528\u4e09\u65b9\u5408\u5e76\u3002<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/4.png\" alt=\"\" width=\"680\" \/><br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/5.png\" alt=\"\" width=\"680\" \/><br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/6.png\" alt=\"\" width=\"680\" \/><br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/7.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>\u5408\u5e76\u51b2\u7a81<\/strong><\/p>\n<p>\u4e24\u4e2a\u5206\u652f\u8fdb\u884c\u5408\u5e76\uff0c\u4f46\u5b83\u4eec\u542b\u6709\u5bf9\u540c\u4e00\u4e2a\u6587\u4ef6\u7684\u4fee\u6539\uff0c\u5219\u5728\u5408\u5e76\u65f6\u51fa\u73b0\u51b2\u7a81\uff0cgit\u65e0\u6cd5\u51b3\u65ad\u8be5\u4fdd\u7559\u6539\u6587\u4ef6\u54ea\u4e2a\u5206\u652f\u7684\u4fee\u6539\u3002<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/8.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/9.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u51fa\u73b0\u51b2\u7a81\u540e\uff0c\u5982\u8981\u7531\u4e24\u4e2a\u5f00\u53d1\u4eba\u5458\u5f53\u9762\u534f\u5546\uff0c\u8be5\u5982\u4f55\u53d6\u820d\uff0c\u4e3a\u51b2\u7a81\u6587\u4ef6\u5b9a\u4e49\u6700\u7ec8\u5185\u5bb9\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p>1.\u4fdd\u7559\u67d0\u4e00\u65b9\u7684\uff0c\u5220\u9664\u53e6\u4e00\u65b9\u7684\u3002<br \/>\n2.\u4fdd\u7559\u53cc\u65b9\u7684<br \/>\n3.\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u8981\u5220\u9664 &lt;&lt;&lt;&lt; \u548c ===== \u4ee5\u53ca &gt;&gt;&gt;&gt;&gt; \u7b26\u53f7<\/p>\n<p>\u518d\u6b21\u63d0\u4ea4\u534f\u5546\u4fee\u6539\u540e\u7684\u5185\u5bb9<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/10.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>\u7248\u672c\u56de\u9000<\/strong><\/p>\n<p>\u6bcf\u6b21\u7684\u4fee\u6539\u2f42\u4ef6\u5e76add\u3001commit \u3002git\u4e2d\u4e5f\u4f1a\u8bb0\u5f55\u2f00\u4e2a\u7248\u672c\u3002\u5982\u679c\u6709\u9700\u8981\u53ef\u4ee5\u56de\u9000\u5230\u4e4b\u524d\u7684\u2f00\u4e2a\u6570\u636e\u7248\u672c\u72b6\u6001\u3002<\/p>\n<p>git reset &#8211;hard HEAD~ # \u56de\u9000\u5230\u4e0a\u2f00\u4e2a\u7248\u672c<\/p>\n<p>git reset &#8211;hard HEAD~~ # \u56de\u9000\u5230\u4e0a\u4e0a\u2f00\u4e2a\u7248\u672c<\/p>\n<p>git reset &#8211;hard HEAD~5 # \u56de\u9000\u5230\u4e0a5\u4e2a\u7248\u672c<\/p>\n<p>git rest &#8211;hard e475a #\u56de\u9000\u5230commitID \u4e3a &#8220;e475a&#8230;&#8221;\u7684\u7248\u672c\uff0c commitID\u53ef\u4ee5\u53ea\u5199\u524d\u2f0f\u4f4d\uff0c\u552f\u2f00\u5373\u53ef<\/p>\n<p>e475afc93c209a690c39c13a46716e8fa000c366=commitID, e475a\u662fcommitID\u7684\u524d\u2f0f\u4f4d<\/p>\n<p>1&gt; \u6bcf\u6b21commit\uff0cgit\u90fd\u4f1a\u4fdd\u7559\u2f00\u4e2a\u7248\u672c\uff0c\u6bcf\u4e2a\u7248\u672c\u90fd\u6709\u2f00\u4e2a\u5168\u5c40\u552f\u2f00\u7684commitID<br \/>\n2&gt; git\u6709\u4e2a\u6e38\u6807\uff1a HEAD \uff0c\u6307\u5411\u5f53\u524d\u7684\u7248\u672c\uff0c\u6240\u4ee5\u53ef\u4ee5\u79fb\u52a8\u6e38\u6807\u6765\u56de\u9000\u7248\u672c<br \/>\n3&gt; \u4e5f\u53ef\u4ee5\u901a\u8fc7 commitID \u56de\u9000\u5230\u67d0\u4e2a\u7248\u672c<br \/>\n4&gt; \u56de\u9000\u5e76\u4e0d\u4f1a\u5220\u9664\u4efb\u4f55\u7248\u672c\uff0c\u6240\u4ee5\u7248\u672c\u95f4\u53ef\u4ee5\u6765\u56de\u5207\u6362<\/p>\n<p>\u7ec6\u8282\uff1a\u53d1\u2f63\u7248\u672c\u56de\u9000\u540e\uff0c\u901a\u8fc7 git log \u53ea\u80fd\u770b\u5230\u6700\u539f\u59cb\u63d0\u4ea4\u70b9 \u2f84 \u5f53\u524d\u63d0\u4ea4\u70b9\u7684 \u2f47\u5fd7\u3002 git reflog \u53ef\u4ee5\u770b\u5168\u90e8\u2f47\u5fd7<\/p>\n<p><strong>\u64a4\u9500\u4fee\u6539<\/strong><\/p>\n<p>\u5de5\u4f5c\u533a\u64a4\u9500\uff1a<\/p>\n<p>git checkout &#8212; hello9.txt \u53ef\u4ee5\u64a4\u9500\u5230\u6700\u8fd1\u2f00\u6b21 git add \u6216 git commit \u7684\u72b6\u6001<\/p>\n<p>\u5982\u679c \u6682\u5b58\u533a\u6709\u6b64\u2f42\u4ef6\uff0c\u5219\u5c06\u6682\u5b58\u533a\u4e2d\u7684\u2f42\u4ef6\u5185\u5bb9\u6062\u590d\u5230\u2f2f\u4f5c\u533a\u3002<br \/>\n\u5982\u679c \u6682\u5b58\u533a\u6ca1\u6709\u6b64\u2f42\u4ef6\uff0c\u5219\u5c06\u5206\u2f40\u4e2d\u7684\u2f42\u4ef6\u5185\u5bb9\u6062\u590d\u5230\u2f2f\u4f5c\u533a\u3002<\/p>\n<p>\u6ce8\u610f\uff1a &#8212; hello9.txt \u2f00\u5b9a\u4e0d\u80fd\u5c11\u5199 &#8212; \uff0c\u5426\u5219\u5c31\u662f\u5176\u4ed6\u8bed\u610f\u5566\u3002<\/p>\n<p><strong>\u6682\u5b58\u533a\u64a4\u9500\uff1a<\/strong><\/p>\n<p>\u5982\u679c\u5728\u2f2f\u4f5c\u533a\u4e2d\u4fee\u6539\u4e86\u2f42\u4ef6\u5e76\u53d1\u9001\u5230\u6682\u5b58\u533a\u4e2d\uff0c\u4f46\u2f42\u4ef6\u4e2d\u6709\u9700\u8981\u64a4\u9500\u7684\u5185\u5bb9<br \/>\n\u5219\u53ef\u4ee5\u6267\u2f8f\uff1a git reset HEAD hello9.txt \u5c06hello.txt\u5728\u6682\u5b58\u533a\u7684\u5185\u5bb9\u6e05\u9664\u3002<br \/>\n\u7136\u540e\u53ef\u6267\u2f8f\uff1a git checkout &#8212; hello9.txt \u56de\u9000\u5230\u4e0a\u2f00\u4e2a\u7248\u672c<\/p>\n<p>&nbsp;<\/p>\n<p><strong>idea\u5173\u8054git<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/11.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>\u5ffd\u7565\u6587\u4ef6<\/strong><\/p>\n<p>\u5148\u521b\u5efa\u5ffd\u7565\u6587\u4ef6\uff1a.gitignore<\/p>\n<p>\u5185\u5bb9\uff1a<\/p>\n<pre>.idea\r\n*.iml\r\ntarget\r\n*.class\r\njdbc.properties\r\n*.jar\r\n*.war<\/pre>\n<p><strong>idea\u521b\u5efagit\u4ed3\u5e93<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/12.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>idea\u63d0\u4ea4\u6587\u4ef6<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/13.png\" alt=\"\" width=\"680\" \/><br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/14.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>idea\u65b0\u589e\u6587\u4ef6\u5f39\u7a97<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/15.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u70b9\u51fbADD \u6216\u8005CANCEL \u4e5f\u53ef\u4ee5<\/p>\n<p><strong>idea\u5173\u8054\u8fdc\u7a0b\u4ed3\u5e93<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/16.png\" alt=\"\" width=\"680\" \/><br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/17.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>idea\u68c0\u6d4b\u94fe\u63a5\u540e\u5f39\u51fa github\u767b\u5f55\uff0c\u8f93\u5165\u8d26\u5bc6\u5373\u53ef<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/18.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>idea\u65b0\u589e\u5206\u652f<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/19.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>idea\u5207\u6362\u5206\u652f<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/21.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>idea\u67e5\u770b\u65e5\u5fd7<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/23\/20.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>idea\u514b\u9686\u8fdc\u7a0b\u4ed3\u5e93<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/24\/1.png\" alt=\"\" width=\"680\" \/><br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/24\/2.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>idea\u4ece\u8fdc\u7a0b\u4ed3\u5e93\u66f4\u65b0\u672c\u5730\u4ed3\u5e93<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/24\/3.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u6253\u5f00\u4e4b\u524d\u7684\u4ed3\u5e93\uff0c\u7136\u540e\u65b0\u5efa\u6587\u4ef6\uff0c\u7136\u540e\u63d0\u4ea4\u5e76\u4e0a\u4f20\u3002<\/p>\n<p>\u5728\u65b0\u7684idea\u7a97\u53e3\u5206\u652f\u5e76\u521b\u5efa\u5206\u652f<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/24\/4.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/24\/5.png\" alt=\"\" width=\"680\" \/><br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/24\/6.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>idea\u51b2\u7a81\u89e3\u51b3<\/strong><\/p>\n<p>\u51b2\u7a81\u6f14\u793a\uff1a<\/p>\n<p>\u5728\u7b2c\u4e00\u4e2a\u4ed3\u5e93\u4fee\u6539\u4e00\u4e2a\u6587\u4ef6\uff0c\u7136\u540e\u63d0\u4ea4\u5e76\u4e0a\u4f20\u8fdc\u7a0b\u4ed3\u5e93\u3002<\/p>\n<p>\u5728\u7b2c\u4e8c\u4e2a\u4ed3\u5e93\u4fee\u6539\u76f8\u540c\u6587\u4ef6\uff0c\u7136\u540e\u4e0a\u4f20\u5e76\u62c9\u53d6pull\uff0c\u7136\u540e\u5f39\u7a97\u51b2\u7a81\u8b66\u544a\u6846<\/p>\n<p>\u7136\u540e\u7ea6\u8c08\u4e24\u4e2a\u5f00\u53d1\u8005\u5546\u8c08\u6700\u7ec8\u7248\u672c<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/24\/7.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u7136\u540e\u67e5\u770b\u4ed3\u5e93\u72b6\u6001\uff1a<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/24\/8.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u7136\u540epush\u63d0\u4ea4\u5230\u8fdc\u7a0b\u4ed3\u5e93<\/p>\n<h2><strong>\u591a\u4eba\u534f\u540c\u5f00\u53d1<\/strong><\/h2>\n<p>\u534f\u540c\u5de5\u4f5c\u6d41\u7a0b<\/p>\n<p><strong>\u9879\u76ee\u7ba1\u7406\u5458\uff08\u9879\u76ee\u7ecf\u7406\uff09<\/strong><\/p>\n<p>\u7ba1\u7406\u5458\u5728github\u521b\u5efa\u79c1\u6709\u4ed3\u5e93\uff0c\u5728idea\u521b\u5efa\u4e00\u4e2a\u7a7a\u9879\u76ee\uff0c\u5305\u542b .gitignore\u2f42\u4ef6\uff0c\u521b\u5efa\u5206\u652f\u3002<\/p>\n<p>\u7136\u540e\u63d0\u4ea4\u5e76push\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u7136\u540e\u5728github\u9080\u8bf7\u6210\u5458\u3002<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/24\/9.png\" alt=\"\" width=\"680\" \/><br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/24\/10.png\" alt=\"\" width=\"680\" \/><\/p>\n<p><strong>\u5f00\u53d1\u4eba\u5458\uff1a<\/strong><\/p>\n<p>\u5728idea\u514b\u9686\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u83b7\u5f97\u9879\u76ee\u3002<\/p>\n<p>\u7136\u540e\u5728idea\u9009\u62e9\u5206\u652f\u5e76\u521b\u5efa\u5206\u652f\u3002<\/p>\n<p>\u540e\u7eed\u7684\u5f00\u53d1\u4e2d\uff0c\u90fd\u8981\u5728\u65b0\u7684\u5206\u652f\u4e0a\u8fdb\u884c\u63d0\u4ea4\u5e76\u4e0a\u4f20\u8fdc\u7a0b\u4ed3\u5e93\u8fdb\u884c\u540c\u6b65\u3002<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u6ce8\u610f\uff1a\u5982\u679c\u5728 git push \u8fdc\u7a0b\u5e93\u65f6\uff0c\u6709\u2f08\u2f50\u4f60\u65e9\u2f00\u6b65 git push ,git\u670d\u52a1\u5668\u5c06\u62d2\u7edd\u4f60\u7684 git push .\uff08\u4e50\u89c2\u9501\u539f\u7406\uff09<\/strong><\/span><br \/>\n<span style=\"color: #ff0000;\"><strong>\u4e0d\u8fc7\u5f88\u7b80\u5355\uff0c\u4f60\u9700\u8981 git pull \u8fdc\u7a0b\u5e93 dev \uff0c\u7136\u540e\u518d git push`\u5373\u53ef<\/strong><\/span><\/p>\n<p>\u540e\u7eed\u7684\u5f00\u53d1\uff0c\u4f1a\u63a5\u5230\u2f00\u4e2a\u4e2a\u7684\u529f\u80fd\u4efb\u52a1\uff0c\u5f80\u590d\u64cd\u4f5c\u3002<\/p>\n<p><strong>\u6548\u679c\uff1a<\/strong><\/p>\n<p>\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u5e94\u8be5\u6309\u7167\u2f0f\u4e2a\u57fa\u672c\u539f\u5219\u8fdb\u2f8f\u5206\u2f40\u7ba1\u7406\uff1a<br \/>\n\u2fb8\u5148\uff0c master \u5206\u2f40\u5e94\u8be5\u662f\u2fae\u5e38\u7a33\u5b9a\u7684\uff0c \u4e5f\u5c31\u662f\u4ec5\u2f64\u6765\u53d1\u5e03\u65b0\u7248\u672c\uff0c\u5e73\u65f6\u4e0d\u80fd\u5728\u4e0a\u2faf\u2f32\u6d3b\uff1b<br \/>\n\u90a3\u5728\u54ea\u2f32\u6d3b\u5462\uff1f\u2f32\u6d3b\u90fd\u5728 \u65b0 \u5206\u2f40\u4e0a\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c \u65b0 \u5206\u2f40\u662f\u4e0d\u7a33\u5b9a\u7684\uff0c\u5230\u67d0\u4e2a\u65f6\u5019\uff0c\u2f50\u59821.0\u7248\u672c\u53d1\u5e03\u65f6\uff0c\u518d\u6709\u7ba1\u7406\u5458\u628a \u65b0 \u5206\u2f40\u5408\u5e76\u5230 master \u4e0a\uff0c\u5728 master \u5206\u2f40\u53d1\u5e031.0\u7248\u672c\uff1b<br \/>\n\u4f60\u548c\u4f60\u7684\u2f29\u4f19\u4f34\u4eec\u6bcf\u4e2a\u2f08\u90fd\u5728 \u65b0 \u5206\u2f40\u4e0a\u2f32\u6d3b\uff0c\u6bcf\u4e2a\u2f08\u90fd\u6709\u2f83\u2f30\u7684\u5206\u2f40\uff0c\u65f6\u4e0d\u65f6\u5730\u5f80 \u65b0 \u5206\u2f40\u4e0a\u5408\u5e76\u5c31\u53ef\u4ee5\u4e86\u3002<br \/>\n\u6240\u4ee5\uff0c\u56e2\u961f\u5408\u4f5c\u7684\u5206\u2f40\u770b\u8d77\u6765\u5c31\u50cf\u8fd9\u6837\uff1a<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/12\/24\/11.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u5982\u4e0a4\u4e2a\u5206\u2f40\uff0c\u7531\u4e0a\u2f7d\u4e0b\u5206\u522b\u662f\u3010\u8fdc\u7a0bmaster\uff0c\u8fdc\u7a0bdev\uff0cmicheal\u7684\u672c\u5730dev\uff0cbob\u7684\u672c\u5730dev\u3011<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u8bbe\u7f6eSSH-KEY<\/strong><\/p>\n<p>git\u672c\u5730\u5e93\u548c github \u6216 \u7801\u4e91 \u4e4b\u95f4\u4f20\u8f93\uff0c\u5efa\u8bae\u8bbe\u7f6eSSH key\uff0c\u907f\u514d\u5728\u4f20\u8f93\u4e2d\u53cd\u590d\u8f93\u2f0a\u5bc6\u7801<br \/>\n\u6267\u2f8f\uff1a ssh-keygen -t rsa -C &#8220;email&#8221; \u7136\u540e\u2f00\u76f4\u56de\u2ecb\u5373\u53ef<br \/>\n-C\u540e&#8221;\u53ef\u4ee5\u968f\u610f\u5199\u2f00\u4e2a\uff0c\u4f5c\u4e3akey\u7684title\u2f7d \u5df2\uff0c\u2f46\u5173\u7d27\u8981&#8221;<br \/>\n\u6700\u540e\uff1a\u5728 C:\\Users\\\u4e3b\u673a\u540d\\.ssh \u2f6c\u5f55\u4e0b\u2f63\u4ea7\u79d8\u94a5\u2f42\u4ef6\uff0c<br \/>\nid_rsa \u662f\u79c1\u94a5\uff0c\u4e0d\u80fd\u6cc4\u9732\u51fa\u53bb\uff0c id_rsa.pub \u662f\u516c\u94a5\uff0c\u53ef\u4ee5\u653e\u2f3c\u5730\u544a\u8bc9\u4efb\u4f55\u2f08\u3002<br \/>\n\u767b\u5f55GitHub\uff0c\u5728\u8d26\u6237\u8bbe\u7f6e\u4e2d\uff0c\u9009\u62e9 &#8220;SSH Keys&#8221; ,\u5728Title\u4e2d\u968f\u4fbf\u586b\u5199\u2f00\u4e2a\uff0c\u5728Key\u4e2d\u586b\u5199 id_rsa.pub \u2f42\u4ef6\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u5373\u53ef\u3002<\/p>\n<h2>\u6807\u7b7e<\/h2>\n<p><strong>\u521b\u5efa\u6807\u7b7e\uff1a<\/strong><\/p>\n<p># \u521b\u5efa\u8f7b\u91cf\u6807\u7b7e<br \/>\ngit tag v1.1.0<br \/>\n# \u521b\u5efa\u9644\u6ce8\u6807\u7b7e \uff08 \u5c31\u662f\u5e26\u8bf4\u660e\u7684\u8f7b\u91cf\u6807\u7b7e \uff09<br \/>\ngit tag -a v1.1.1 -m &#8220;\u8bf4\u660e\u2f42\u5b57&#8221;<br \/>\n#\u6ce8\u610f\uff0c\u521b\u5efa\u7684\u6807\u7b7e\u4f1a\u2f83\u52a8 \u6253\u5728\u6700\u8fd1\u7684\u63d0\u4ea4\u70b9\u4e0a<br \/>\n#\u5982\u679c\u8981\u7ed9\u8fc7\u5f80\u7684\u63d0\u4ea4\u70b9 \u8ffd\u6253\u6807\u7b7e\uff0c\u9700\u8981 git log \u53bb\u67e5\u770b\u63d0\u4ea4\u70b9\u7684 \u201ccommitID\u201d<br \/>\ngit tag [-a] v1.1.1 &#8220;commitID&#8221;<\/p>\n<p><strong>\u67e5\u770b\u6807\u7b7e\uff1a<\/strong><\/p>\n<p>#\u67e5\u770b\u6240\u6709\u5206\u2f40\u4e0a\u7684\u6240\u6709\u6807\u7b7e ( \u67e5\u770b\u6807\u7b7e\u5e76\u4e0d\u533a\u5206\u5206\u2f40 )<br \/>\ngit tag<br \/>\n#\u67e5\u627e\u6807\u7b7e\u540d\u4ee5 \u201cv1.1\u201d\u5f00\u5934\u7684\u6807\u7b7e<br \/>\ngit tag -l &#8220;v1.1*&#8221;<br \/>\n#\u663e\u793a\u6807\u7b7e \u53ca\u5176\u5bf9\u5e94\u7684\u63d0\u4ea4\u70b9\u4fe1\u606f<br \/>\ngit show v1.1.0<\/p>\n<p><strong>\u5171\u4eab\u6807\u7b7e<\/strong><\/p>\n<p>\u6807\u7b7e\u4e0d\u4f1a\u968f\u63d0\u4ea4\u70b9\u2f00\u8d77 \u63d0\u4ea4\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\uff0c\u9700\u8981\u5355\u72ecpush\u3002<br \/>\npull\u65f6\uff0c\u6807\u7b7e\u4f1a\u2f00\u540c\u88ab\u4e0b\u8f7d\u5230\u672c\u5730<\/p>\n<p># \u540c\u6b65\u2f00\u4e2a\u6807\u7b7e \u201cv1.1.1\u201d \u5230git\u670d\u52a1\u5668<br \/>\ngit push origin v1.1.1<br \/>\n# \u540c\u6b65\u6240\u6709\u6807\u7b7e \u5230git\u670d\u52a1\u5668<br \/>\ngit push origin &#8211;tags<\/p>\n<p><strong>\u5220\u9664\u6807\u7b7e<\/strong><\/p>\n<p>\u6807\u7b7e\u5220\u9664\u9700\u8981\u5728\u672c\u5730\u548c\u8fdc\u7a0b\u5206\u522b\u5220\u9664\u3002<\/p>\n<p># \u5728\u672c\u5730\u5220\u9664\u6807\u7b7e<br \/>\ngit tag -d v1.1.1<br \/>\n# \u5220\u9664\u8fdc\u7a0b\u5e93\u4e2d\u7684\u6807\u7b7e<br \/>\ngit push origin :refs\/tags\/v1.1.1<\/p>\n<p><strong>\u6807\u7b7e\u7684\u4f7f\u7528<\/strong><\/p>\n<p>\u6807\u7b7e\u4e3b\u8981\u2f64\u4e8e\u53d1\u5e03\u7248\u672c\u3002<br \/>\n\u5047\u5b9a\u5df2\u7ecf\u4e3a\u5404\u4e2a\u53d1\u5e03\u7248\u672c\u6253\u4e86\u6807\u7b7e\uff1a v1.0 v1.1 v2.0 &#8230;.<br \/>\n\u73b0\u5728\u9700\u8981 1.0 \u7248\u672c<\/p>\n<p># \u5206\u79bb\u2f00\u4e2a\u6307\u9488\u5230 v1.0\u63d0\u4ea4\u70b9\u4f4d\u7f6e<br \/>\ngit checkout v1.0 #\uff08 \u5206\u79bb\u5934\u6307\u9488\uff0c\u662f\u2f00\u4e2a\u4e34\u65f6\u6307\u9488\uff0c\u4e0d\u5f52\u5c5e\u4efb\u4f55\u5206\u2f40 \uff09<br \/>\ngit checkout commitId #\uff08 \u5206\u79bb\u5934\u6307\u9488\uff0c\u662f\u2f00\u4e2a\u4e34\u65f6\u6307\u9488\uff0c\u4e0d\u5f52\u5c5e\u4efb\u4f55\u5206\u2f40,\u4e0d\u5982\u6807\u7b7e\u2f45\u4fbf \uff09<br \/>\n# \u7136\u540e\u5c06\u2f2f\u4f5c\u533a\u7684\u4ee3\u7801\u6253\u5305(jar\u6216war)\u5373\u53ef\u3002<br \/>\nmvn package<br \/>\n# \u6700\u540e\u968f\u610f\u5207\u2f00\u4e2a\u5206\u2f40\uff0c\u5206\u79bb\u5934\u6307\u9488\u6d88\u5931\u3002\u4ec0\u4e48\u4e5f\u6ca1\u53d1\u2f63\u8fc7\u3002<br \/>\ngit checkout \u201d\u4efb\u610f\u5206\u2f40\u201c<\/p>\n<p><strong>\u5b58\u50a8\u5de5\u4f5c<\/strong><\/p>\n<p>\u529f\u80fd\u8fd8\u6ca1\u5199\u5b8c\uff0c\u8fd8\u4e0d\u9002\u5408\u63d0\u4ea4\uff0c\u4f46\u6b64\u65f6\u9700\u8981\u53bb\u89e3\u51b3\u53e6\u2f00\u4e2abug\uff0c\u9700\u8981\u5207\u6362\u5206\u2f40\uff0c\u5219\u5f53\u524d\u529f\u80fd\u2f2f\u4f5c\u533a\u4e2d\u7684\u6539\u52a8\u4f1a\u88ab\u65b0\u5206\u2f40\u7684\u5185\u5bb9\u8986\u76d6\uff0c\u6240\u4ee5\u6b64\u65f6\u53ef\u4ee5\u5148\u50a8\u5b58\u4e0b\u5f53\u524d\u529f\u80fd\u7684\u5185\u5bb9\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u653e\u2f3c\u7684\u5207\u6362\u5230\u5176\u4ed6\u5206\u2f40\u5148\u2f32\u522b\u7684\u4e8b\uff0c\u8fc7\u540e\u518d\u56de\u6765<\/p>\n<p>git stash \uff1a\u50a8\u5b58\u5f53\u524d\u4fee\u6539( \u672a\u63d0\u4ea4\u7684\u5185\u5bb9 \uff0c\u5305\u62ec\u672a\u6682\u5b58\u548c\u5df2\u6682\u5b58\u7684)<\/p>\n<p>git stash list \uff1a\u67e5\u770b\u5b58\u50a8\u5217\u8868<\/p>\n<p>git checkout \u5176\u4ed6\u5206\u2f40 \uff1a\u53ef\u4ee5\u653e\u2f3c\u7684\u5207\u5230\u5176\u4ed6\u5206\u2f40\uff0c\u5b8c\u6210\u5176\u4ed6\u2f2f\u4f5c<\/p>\n<p>git checkout dev \uff1a\u5207\u56dedev\u5206\u2f40\uff0c\u5e76\uff1a git stash apply \uff1a\u6062\u590d\u50a8\u5b58\u7684\u2f2f\u4f5c\uff0c\u7ee7\u7eed\u7f16\u7801<\/p>\n<p>\u6ce8\u610f\uff1a\u6ca1\u2f64\u7684\u5b58\u50a8\u5efa\u8bae\u5220\u9664\uff1a git stash drop stash@{0} \uff1a\u5220\u9664\u67d0\u2f00\u4e2a\u50a8\u5b58\u70b9<\/p>\n<p>git stash clear \uff1a\u6e05\u7a7a\u6240\u6709\u50a8\u5b58\u70b9<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2020\u6700\u65b0\u7248Git\u6559\u7a0b git\u5b89\u88c5\u4ee5\u53ca\u521d\u59cb\u5316 \u67e5\u770bgit\u7248\u672c\uff1agit &#8211;version \u8bbe\u7f6e\u7528\u6237 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-2821","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2821"}],"version-history":[{"count":14,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2821\/revisions"}],"predecessor-version":[{"id":2836,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2821\/revisions\/2836"}],"wp:attachment":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}