{"id":1553,"date":"2020-11-04T12:44:43","date_gmt":"2020-11-04T04:44:43","guid":{"rendered":"https:\/\/www.yusian.com\/blog\/?p=1553"},"modified":"2020-11-09T10:22:43","modified_gmt":"2020-11-09T02:22:43","slug":"git%e4%bb%a3%e7%a0%81%e4%bb%93%e5%ba%93%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4%e9%9b%86","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/project\/2020\/11\/04\/1244431553.html","title":{"rendered":"git\u4ee3\u7801\u4ed3\u5e93\u5e38\u7528\u547d\u4ee4\u96c6"},"content":{"rendered":"<ol>\n<li><strong>\u67e5\u770b\u5f53\u524d\u72b6\u6001<\/strong> <code>git status<\/code>\uff0c\u67e5\u770b\u5f53\u524d\u54ea\u4e9b\u4ee3\u7801\u672a\u63d0\u4ea4\uff0c\u53ca\u6587\u4ef6\u4fee\u6539\u72b6\u6001\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git status\nOn branch developer\nChanges not staged for commit:\n (use \"git add\/rm &lt;file&gt;...\" to update what will be committed)\n (use \"git restore &lt;file&gt;...\" to discard changes in working directory)\n       modified:   .eslintrc.js\n       modified:   package.json\n       modified:   src\/App.vue\n       deleted:    src\/components\/HelloWorld.vue\n       modified:   src\/main.js\n       modified:   src\/plugins\/element.js\n       modified:   src\/router\/index.js\n       deleted:    src\/views\/About.vue\n       deleted:    src\/views\/Home.vue\n       modified:   yarn.lock\n\nUntracked files:\n (use \"git add &lt;file&gt;...\" to include in what will be committed)\n       src\/components\/home.vue\n       src\/components\/login.vue\n       vue.config.js\n\nno changes added to commit (use \"git add\" and\/or \"git commit -a\")\n<\/code><\/pre>\n<\/li>\n<li><strong>\u67e5\u770b\u5206\u652f<\/strong> <code>git branch<\/code>\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git branch\n* developer\n master\n<\/code><\/pre>\n<\/li>\n<li><strong>\u6dfb\u52a0\u6587\u4ef6<\/strong> <code>git add .<\/code>\uff0c\u5982\u679c\u6dfb\u52a0\u5355\u4e2a\u6587\u4ef6\u540e\u9762\u8ddf\u6587\u4ef6\u540d\uff0c\u5982\u679c\u6dfb\u52a0\u6240\u6709\u6587\u4ef6\u4f7f\u7528\u901a\u914d\u7b26<code>.<\/code>\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git add .\nyusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git status\nOn branch developer\nChanges to be committed:\n (use \"git restore --staged &lt;file&gt;...\" to unstage)\n       modified:   .eslintrc.js\n       modified:   package.json\n       modified:   src\/App.vue\n       deleted:    src\/components\/HelloWorld.vue\n       new file:   src\/components\/home.vue\n       new file:   src\/components\/login.vue\n       modified:   src\/main.js\n       modified:   src\/plugins\/element.js\n       modified:   src\/router\/index.js\n       deleted:    src\/views\/About.vue\n       deleted:    src\/views\/Home.vue\n       new file:   vue.config.js\n       modified:   yarn.lock\n<\/code><\/pre>\n<p><!--more--><\/li>\n<li><strong>\u63d0\u4ea4\u6587\u4ef6<\/strong> <code>git commit -m 'xxxx'<\/code>\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git commit -m 'login complete' \n[developer 7f226a9] login complete\n13 files changed, 254 insertions(+), 155 deletions(-)\nrewrite src\/App.vue (83%)\ndelete mode 100644 src\/components\/HelloWorld.vue\ncreate mode 100644 src\/components\/home.vue\ncreate mode 100644 src\/components\/login.vue\nrewrite src\/router\/index.js (73%)\ndelete mode 100644 src\/views\/About.vue\ndelete mode 100644 src\/views\/Home.vue\ncreate mode 100644 vue.config.js\n<\/code><\/pre>\n<\/li>\n<li><strong>\u5207\u6362\u5206\u652f<\/strong> <code>git checkout xxx<\/code>\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git checkout master\nSwitched to branch 'master'\n<\/code><\/pre>\n<\/li>\n<li><strong>\u5408\u5e76\u5206\u652f<\/strong> <code>git merge xxx<\/code>\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git merge developer\nUpdating 85c9d12..7f226a9\nFast-forward\n.eslintrc.js                  |   2 ++\npackage.json                  |   2 ++\nsrc\/App.vue                   |  29 +++++++----------------------\nsrc\/components\/HelloWorld.vue |  59 -----------------------------------------------------------\nsrc\/components\/home.vue       |  12 ++++++++++++\nsrc\/components\/login.vue      | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\nsrc\/main.js                   |   4 +++-\nsrc\/plugins\/element.js        |   7 +++++--\nsrc\/router\/index.js           |  36 +++++++++++++++++++-----------------\nsrc\/views\/About.vue           |   5 -----\nsrc\/views\/Home.vue            |  18 ------------------\nvue.config.js                 |   5 +++++\nyarn.lock                     |  60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------\n13 files changed, 229 insertions(+), 130 deletions(-)\ndelete mode 100644 src\/components\/HelloWorld.vue\ncreate mode 100644 src\/components\/home.vue\ncreate mode 100644 src\/components\/login.vue\ndelete mode 100644 src\/views\/About.vue\ndelete mode 100644 src\/views\/Home.vue\ncreate mode 100644 vue.config.js\n<\/code><\/pre>\n<\/li>\n<li><strong>\u521b\u5efa\u5206\u652f<\/strong> <code>git checkout -b xxx<\/code>\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git checkout -b home\nSwitched to a new branch 'home'\nyusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git branch\n developer\n* home\n master\n<\/code><\/pre>\n<\/li>\n<li><strong>\u5220\u9664\u672c\u5730\u5206\u652f<\/strong> <code>git branch -d xxx<\/code>\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git branch -d home\nDeleted branch home (was 7f226a9).\nyusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git branch\n* developer\n master\n<\/code><\/pre>\n<\/li>\n<li><strong>\u8bbe\u7f6e\u8fdc\u7a0b\u4ee3\u7801\u4ed3\u5e93\u5730\u5740<\/strong> <code>git remote add origin https:\/\/xxx.xxx.xxx\/xxx.git<\/code>\n<pre><code class=\"language-cmd line-numbers\">git remote add origin https:\/\/e.coding.net\/yusian\/vue\/shop.git\n<\/code><\/pre>\n<\/li>\n<li><strong>\u63a8\u9001\u5230\u8fdc\u7a0b\u6307\u5b9a\u5206\u652f<\/strong> <code>git push -u origin master<\/code>\uff0c\u5982\u679c\u5df2\u5b58\u5728\u8fdc\u7a0b\u5206\u652f\u53ef\u7701\u7565\u53c2\u6570-u\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git push -u origin master\nEnumerating objects: 55, done.\nCounting objects: 100% (55\/55), done.\nDelta compression using up to 4 threads\nCompressing objects: 100% (48\/48), done.\nWriting objects: 100% (55\/55), 125.72 KiB | 4.49 MiB\/s, done.\nTotal 55 (delta 14), reused 0 (delta 0)\nTo https:\/\/e.coding.net\/yusian\/vue\/shop.git\n * [new branch]      master -&gt; master\nBranch 'master' set up to track remote branch 'master' from 'origin'.\nyusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git push \nEverything up-to-date\n<\/code><\/pre>\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git checkout developer\nSwitched to branch 'developer'\nyusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git push -u origin developer\nTotal 0 (delta 0), reused 0 (delta 0)\nTo https:\/\/e.coding.net\/yusian\/vue\/shop.git\n * [new branch]      developer -&gt; developer\nBranch 'developer' set up to track remote branch 'developer' from 'origin'.\nyusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% \n<\/code><\/pre>\n<\/li>\n<li><strong>\u4fee\u6539\u672c\u5730\u5206\u652f<\/strong> <code>git branch -m old new<\/code>\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git branch -m developer login\nyusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git branch\n* login\n  master\n  user\n<\/code><\/pre>\n<\/li>\n<li><strong>\u4fee\u6539\u8fdc\u7a0b\u5206\u652f<\/strong> \u5176\u5b9e\u662f\u5220\u9664\u539f\u8fdc\u7a0b\u5206\u652f<code>git push --delete origin old<\/code>\uff0c\u518d\u521b\u5efa\u65b0\u5206\u652f<code>git push -u origin new<\/code>\n<pre><code class=\"language-cmd line-numbers\">yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git push --delete origin developer\nTo https:\/\/e.coding.net\/yusian\/vue\/shop.git\n - [deleted]         developer\nyusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git push -u origin login\nTotal 0 (delta 0), reused 0 (delta 0)\nTo https:\/\/e.coding.net\/yusian\/vue\/shop.git\n * [new branch]      login -&gt; login\nBranch 'login' set up to track remote branch 'login' from 'origin'.\n<\/code><\/pre>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u770b\u5f53\u524d\u72b6\u6001 git status\uff0c\u67e5\u770b\u5f53\u524d\u54ea\u4e9b\u4ee3\u7801\u672a\u63d0\u4ea4\uff0c\u53ca\u6587\u4ef6\u4fee\u6539\u72b6\u6001 yusian@Work-SianMac:~\/Documents\/Project\/Vue\/demo34% git status On branch developer Changes not staged for commit: (use &#8220;git add\/rm &lt;file&gt;&#8230;&#8221; to update what will be committed) (use &#8220;git restore &lt;file&gt;&#8230;&#8221; to discard changes in working directory) modified: .eslintrc.js modified: package.json modified: src\/App.vue deleted: src\/components\/HelloWorld.vue modified: src\/main.js modified: src\/plugins\/element.js modified: src\/router\/index.js deleted: src\/views\/About.vue deleted: src\/views\/Home.vue modified: yarn.lock Untracked [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[47,45,245],"class_list":["post-1553","post","type-post","status-publish","format-standard","hentry","category-project","tag-git","tag-github","tag-245"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=1553"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1553\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=1553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=1553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=1553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}