﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-paulwong-随笔分类-GIT</title><link>http://www.blogjava.net/paulwong/category/55032.html</link><description /><language>zh-cn</language><lastBuildDate>Mon, 14 Apr 2025 10:32:38 GMT</lastBuildDate><pubDate>Mon, 14 Apr 2025 10:32:38 GMT</pubDate><ttl>60</ttl><item><title>GitHub无法访问的办法</title><link>http://www.blogjava.net/paulwong/archive/2025/01/05/451538.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Sun, 05 Jan 2025 04:08:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2025/01/05/451538.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/451538.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2025/01/05/451538.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/451538.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/451538.html</trackback:ping><description><![CDATA[<div>浏览器打开<a href="https://www.ipaddress.com/website/www.github.com/" target="_blank">https://www.ipaddress.com/website/www.github.com/</a>, 输入www.github.com, 得到相应的ip, 本地clone以ip的方式, 但如果要访问页面, 需改本地的hosts文件:</div>
<div><br />
</div>
<div>
<div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; border-image: none; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
-->#&nbsp;/etc/hosts<br />
140.82.112.4&nbsp;&nbsp;&nbsp;&nbsp;www.github.com</div>
</div>
<div><br />
</div>
<div><br />
</div>
<div><br />
</div>
<div><br />
</div>
<img src ="http://www.blogjava.net/paulwong/aggbug/451538.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2025-01-05 12:08 <a href="http://www.blogjava.net/paulwong/archive/2025/01/05/451538.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>通过SSH的方式PUSH代码到GIT</title><link>http://www.blogjava.net/paulwong/archive/2024/07/24/451470.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Wed, 24 Jul 2024 04:31:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2024/07/24/451470.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/451470.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2024/07/24/451470.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/451470.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/451470.html</trackback:ping><description><![CDATA[<div>这几天要PUSH代码到GITHUB，发现之前用的密码方式被取消了，需改成SSH KEY的方式。</div>
<div></div>
<div></div>
<div>
<h3>1.生成SSH-KEY</h3>
</div>
<div>
<div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #000000; ">ssh</span><span style="color: #000000; ">-</span><span style="color: #000000; ">keygen<br />
#会产生&nbsp;</span><span style="color: #000000; ">~/</span><span style="color: #000000; ">.ssh</span><span style="color: #000000; ">/</span><span style="color: #000000; ">id_rsa&nbsp;和&nbsp;</span><span style="color: #000000; ">~/</span><span style="color: #000000; ">.ssh</span><span style="color: #000000; ">/</span><span style="color: #000000; ">id_rsa_pub&nbsp;文件</span></div>
<div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><span style="color: #000000; ">#如果是从别的地方拷贝过来的id_rsa，需chmod 400 ~/.ssh/id_rsa更改属性</span></div>
</div>
<div></div>
<div>
<h3>2.在github上新建仓库</h3>
</div>
<div>https://github.com/paulwong888/python-ai</div>
<div></div>
<div>
<h3>3.导入公钥到github</h3>
</div>
<div>打开你的SSH公钥文件，通常位于~/.ssh/id_rsa.pub。复制公钥内容，然后登录到你的GitHub账户，进入Settings &gt; SSH and GPG keys，点击"New SSH key"按钮，粘贴你的公钥，然后点击"Add SSH key"。</div>
<div></div>
<div>
<h3>4.克隆仓库</h3>
</div>
<div>
<div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;">git config --global user.name "John Doe"<br />
git config --global user.email johndoe@example.com</div>
<div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #000000; ">git&nbsp;clone&nbsp;git@github.com:paulwong888</span><span style="color: #000000; ">/</span><span style="color: #000000; ">python</span><span style="color: #000000; ">-</span><span style="color: #000000; ">ai</span></div>
</div>
<div></div>
<div>
<h3>5.导入project到eclipse</h3>
</div>
<div>上步克隆时已经在本地新建了一个本地仓库，Import-&gt;Git-&gt;Project from Git-&gt;Existing local repository，选择python-ai/.git文件夹</div>
<div></div>
<div>之后的操作和用密码的方式是一样的。</div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div><br />
</div>
<div>如果是vs code的操作，可参考：<a href="https://juejin.cn/post/6993612656410099719" target="_blank">https://juejin.cn/post/6993612656410099719</a></div><img src ="http://www.blogjava.net/paulwong/aggbug/451470.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2024-07-24 12:31 <a href="http://www.blogjava.net/paulwong/archive/2024/07/24/451470.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Gitee代码托管实践：让代码变得更加有序可靠</title><link>http://www.blogjava.net/paulwong/archive/2021/08/20/435948.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Fri, 20 Aug 2021 06:49:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2021/08/20/435948.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/435948.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2021/08/20/435948.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/435948.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/435948.html</trackback:ping><description><![CDATA[<a href="https://my.oschina.net/gitosc/blog/5187695" target="_blank">https://my.oschina.net/gitosc/blog/5187695</a><br /><br /><img src ="http://www.blogjava.net/paulwong/aggbug/435948.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2021-08-20 14:49 <a href="http://www.blogjava.net/paulwong/archive/2021/08/20/435948.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Git/EGit | reset 和 revert 的区别</title><link>http://www.blogjava.net/paulwong/archive/2021/08/17/435945.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Tue, 17 Aug 2021 02:37:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2021/08/17/435945.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/435945.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2021/08/17/435945.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/435945.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/435945.html</trackback:ping><description><![CDATA[<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">git的世界里有后悔药吗？</p>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">有的。不仅有，还不止一种：Reset 和 Revert。它们有什么区别呢？先说结论吧。</p>
<table style="border-collapse: collapse; border-spacing: 0px; max-width: 100%; background-color: #ffffff; border-style: solid; border-color: #cccccc; margin: 0.5em 0px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px;">
     <thead style="box-sizing: border-box;">
         <tr style="box-sizing: border-box;">
             <td style="box-sizing: border-box; padding: 0.3em 0.8em; border-style: solid; border-color: #cccccc;"></td>
             <th style="box-sizing: border-box; padding: 0.3em 0.8em; text-align: left; border: 1px solid #cccccc; background: #f1f1f1;">Reset</th><th style="box-sizing: border-box; padding: 0.3em 0.8em; text-align: left; border: 1px solid #cccccc; background: #f1f1f1;">Revert</th>
         </tr>
     </thead>
     <tbody style="box-sizing: border-box;">
         <tr style="box-sizing: border-box;">
             <td style="box-sizing: border-box; padding: 0.3em 0.8em; border-style: solid; border-color: #cccccc;">作用</td>
             <td style="box-sizing: border-box; padding: 0.3em 0.8em; border-style: solid; border-color: #cccccc;">将某个commit之后的push全部回滚</td>
             <td style="box-sizing: border-box; padding: 0.3em 0.8em; border-style: solid; border-color: #cccccc;">将某个指定的commit回滚</td>
         </tr>
         <tr style="box-sizing: border-box;">
             <td style="box-sizing: border-box; padding: 0.3em 0.8em; border-style: solid; border-color: #cccccc;">历史记录（轨迹）</td>
             <td style="box-sizing: border-box; padding: 0.3em 0.8em; border-style: solid; border-color: #cccccc;">无</td>
             <td style="box-sizing: border-box; padding: 0.3em 0.8em; border-style: solid; border-color: #cccccc;">有</td>
         </tr>
         <tr style="box-sizing: border-box;">
             <td style="box-sizing: border-box; padding: 0.3em 0.8em; border-style: solid; border-color: #cccccc;">是否可作用于单个文件</td>
             <td style="box-sizing: border-box; padding: 0.3em 0.8em; border-style: solid; border-color: #cccccc;">否（都是作用于commit，与文件无关）</td>
             <td style="box-sizing: border-box; padding: 0.3em 0.8em; border-style: solid; border-color: #cccccc;">否</td>
         </tr>
     </tbody>
</table>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">下面来说说具体例子。</p>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;"></p>
<h1>Revert</h1>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">试验步骤如下：</p>
<ol style="box-sizing: border-box; margin-top: 0px; margin-bottom: 10px; margin-left: 0px; padding-left: 20px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">
     <li style="box-sizing: border-box;">新建两个空白文件 Revert.txt 和 Common.txt，然后commit&amp;push。</li>
     <li style="box-sizing: border-box;">修改 Revert.txt 文件，内容为&#8220;commit 1&#8221;，然后commit&amp;push，提交的备注为&#8220;commit 1 of Revert&#8221;</li>
     <li style="box-sizing: border-box;">修改 Common.txt 文件，内容为&#8220;update for Revert(by commit 2)&#8221;</li>
     <li style="box-sizing: border-box;">修改 Revert.txt 文件，新增一行，内容为&#8220;commit 2&#8221;</li>
     <li style="box-sizing: border-box;">3 和 4的修改一起commit&amp;push，提交备注为&#8220;commit 2 of Revert(Revert.txt + Common.txt)&#8221;</li>
</ol>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">效果如下：</p>
<div id="attachment_1035"  aligncenter"="" style="box-sizing: border-box; clear: both; margin: 0px auto; text-align: center; max-width: 100%; height: auto; font-style: italic; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff; width: 450px;"><img aria-describedby="caption-attachment-1035" loading="lazy" src="http://www.youngzy.com/wp-content/uploads/2019/08/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7-2019-08-25-%E4%B8%8A%E5%8D%8812.30.57-300x238.png" alt="git-revert-01" width="450" height="357" srcset="http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-上午12.30.57-300x238.png 300w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-上午12.30.57-768x609.png 768w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-上午12.30.57-1024x812.png 1024w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-上午12.30.57.png 1196w" sizes="(max-width: 450px) 100vw, 450px" style="box-sizing: border-box; border: 0px; vertical-align: middle; display: block; max-width: 100%; height: auto; margin: 5px 0px;" />
<p id="caption-attachment-1035" style="box-sizing: border-box; margin: 0px;">图1-revert之前</p>
</div>
<h2>目的</h2>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">保留3的修改，回滚4的修改。</p>
<h2>操作</h2>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">选中&#8220; Revert.txt &#8221;文件，然后在 History 里选中 &#8220;commit 2 of Revert&#8230;&#8221;，右键，找到&#8220;<span style="box-sizing: border-box; font-weight: 700;">Revert Commit</span>&#8221;菜单，如图：</p>
<div id="attachment_1043"  aligncenter"="" style="box-sizing: border-box; clear: both; margin: 0px auto; text-align: center; max-width: 100%; height: auto; font-style: italic; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff; width: 450px;"><img aria-describedby="caption-attachment-1043" loading="lazy" src="http://www.youngzy.com/wp-content/uploads/2019/08/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7-2019-08-25-%E4%B8%8B%E5%8D%8811.29.23-1024x303.png" alt="git-revert-02" width="450" height="133" srcset="http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-下午11.29.23-1024x303.png 1024w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-下午11.29.23-300x89.png 300w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-下午11.29.23-768x227.png 768w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-下午11.29.23.png 1292w" sizes="(max-width: 450px) 100vw, 450px" style="box-sizing: border-box; border: 0px; vertical-align: middle; display: block; max-width: 100%; height: auto; margin: 5px 0px;" />
<p id="caption-attachment-1043" style="box-sizing: border-box; margin: 0px;">图2-revert操作</p>
</div>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">点击后，效果如图：</p>
<div id="attachment_1044"  aligncenter"="" style="box-sizing: border-box; clear: both; margin: 0px auto; text-align: center; max-width: 100%; height: auto; font-style: italic; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff; width: 450px;"><img aria-describedby="caption-attachment-1044" loading="lazy" src="http://www.youngzy.com/wp-content/uploads/2019/08/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7-2019-08-25-%E4%B8%8B%E5%8D%8811.40.34-1024x581.png" alt="git-revert-03" width="450" height="255" srcset="http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-下午11.40.34-1024x581.png 1024w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-下午11.40.34-300x170.png 300w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-下午11.40.34-768x436.png 768w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-25-下午11.40.34.png 1178w" sizes="(max-width: 450px) 100vw, 450px" style="box-sizing: border-box; border: 0px; vertical-align: middle; display: block; max-width: 100%; height: auto; margin: 5px 0px;" />
<p id="caption-attachment-1044" style="box-sizing: border-box; margin: 0px;">图3-revert之后</p>
</div>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">最后，push即可。</p>
<h2>结果</h2>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">未能达到预期效果，Revert.txt 和 Common.txt的修改都被撤销了。Revert的作用范围是一个commit（原子），跟文件的个数无关。</p>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">注：对最后一个commit做revert比较简单，两步：一，revert；二，push就可以了。对于较早的commit，因为中间间隔了其他的commit，文件会有冲突，需要处理完冲突才可以commit&amp;push。</p>
<h1>Reset</h1>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">试验步骤如下：</p>
<ol style="box-sizing: border-box; margin-top: 0px; margin-bottom: 10px; margin-left: 0px; padding-left: 20px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">
     <li style="box-sizing: border-box;">新建空白文件 Reset.txt，然后commit&amp;push。</li>
     <li style="box-sizing: border-box;">修改 Reset.txt 文件，内容为&#8220;commit 1&#8221;</li>
     <li style="box-sizing: border-box;">修改 Common.txt 文件，内容为&#8220;update for Reset(commit 1)&#8221;</li>
     <li style="box-sizing: border-box;">2和3的修改一起commit&amp;push，提交的备注为&#8220;commit 1 of Reset&#8221;</li>
     <li style="box-sizing: border-box;">修改 Reset.txt 文件，新增一行，内容为&#8220;commit 2&#8221;，然后commit&amp;push，提交的备注为&#8220;commit 2 of Reset&#8221;</li>
     <li style="box-sizing: border-box;">修改 Reset.txt 文件，内容为&#8220;commit 3&#8221;</li>
     <li style="box-sizing: border-box;">修改 Common.txt 文件，内容为&#8220;update for Reset(commit 3)&#8221;</li>
     <li style="box-sizing: border-box;">6和7的修改一起commit&amp;push，提交的备注为&#8220;commit 3 of Reset&#8221;</li>
</ol>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">效果如下：</p>
<div style="box-sizing: border-box; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;"></div>
<div id="attachment_1048"  aligncenter"="" style="box-sizing: border-box; clear: both; margin: 0px auto; text-align: center; max-width: 100%; height: auto; font-style: italic; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff; width: 450px;"><img aria-describedby="caption-attachment-1048" loading="lazy" src="http://www.youngzy.com/wp-content/uploads/2019/08/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7-2019-08-26-%E4%B8%8B%E5%8D%8811.10.07.png" alt="git-reset-04" width="450" height="330" srcset="http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.10.07.png 824w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.10.07-300x220.png 300w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.10.07-768x563.png 768w" sizes="(max-width: 450px) 100vw, 450px" style="box-sizing: border-box; border: 0px; vertical-align: middle; display: block; max-width: 100%; height: auto; margin: 5px 0px;" />
<p id="caption-attachment-1048" style="box-sizing: border-box; margin: 0px;">图4-reset之前</p>
</div>
<h2>目的</h2>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">将commit 1 之后的（即commit 2 和 3）改动全部回滚。</p>
<h2>操作</h2>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">在 History 里找到&#8220;commit 1&#8221;，选中后，右键，找到 Reset 菜单，选择 Hard 模式。</p>
<div id="attachment_1050"  aligncenter"="" style="box-sizing: border-box; clear: both; margin: 0px auto; text-align: center; max-width: 100%; height: auto; font-style: italic; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff; width: 450px;"><img aria-describedby="caption-attachment-1050" loading="lazy" src="http://www.youngzy.com/wp-content/uploads/2019/08/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7-2019-08-26-%E4%B8%8B%E5%8D%8811.16.06-1024x244.png" alt="git-reset-05" width="450" height="107" srcset="http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.16.06-1024x244.png 1024w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.16.06-300x72.png 300w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.16.06-768x183.png 768w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.16.06.png 1684w" sizes="(max-width: 450px) 100vw, 450px" style="box-sizing: border-box; border: 0px; vertical-align: middle; display: block; max-width: 100%; height: auto; margin: 5px 0px;" />
<p id="caption-attachment-1050" style="box-sizing: border-box; margin: 0px;">图5-reset</p>
</div>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">执行后，如下图所示，HEAD 已经指向里 commit 1，Common.txt 和 Reset.txt 的内容也已改变。注意左侧的项目栏，它已落后了服务器（GitHub）2个commit。怎么提交到服务器上呢？直接push，它会提示不是最新的，操作失败。这里要用到 push 的 force 属性。</p>
<div id="attachment_1055"  aligncenter"="" style="box-sizing: border-box; clear: both; margin: 0px auto; text-align: center; max-width: 100%; height: auto; font-style: italic; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff; width: 450px;"><img aria-describedby="caption-attachment-1055" loading="lazy" src="http://www.youngzy.com/wp-content/uploads/2019/08/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7-2019-08-26-%E4%B8%8B%E5%8D%8811.21.11-1024x517.png" alt="git-reset-06" width="450" height="227" srcset="http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.21.11-1024x517.png 1024w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.21.11-300x151.png 300w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.21.11-768x388.png 768w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.21.11.png 1074w" sizes="(max-width: 450px) 100vw, 450px" style="box-sizing: border-box; border: 0px; vertical-align: middle; display: block; max-width: 100%; height: auto; margin: 5px 0px;" />
<p id="caption-attachment-1055" style="box-sizing: border-box; margin: 0px;">图6-reset之后</p>
</div>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">选中 项目，右键 &#8211; Team &#8211; Remote &#8211; Configure Push to Upstream，在打开的小窗口中找到 Advanced，如下图所示，这里的&nbsp;<span style="box-sizing: border-box; font-weight: 700;">Force Update</span>&nbsp;要勾上，表示强制覆盖。</p>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">重新push，就可以跟服务器保持同步了。</p>
<div id="attachment_1056"  aligncenter"="" style="box-sizing: border-box; clear: both; margin: 0px auto; text-align: center; max-width: 100%; height: auto; font-style: italic; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff; width: 450px;"><img aria-describedby="caption-attachment-1056" loading="lazy" src="http://www.youngzy.com/wp-content/uploads/2019/08/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7-2019-08-26-%E4%B8%8B%E5%8D%8811.43.43-1024x999.png" alt="git-reset-07" width="450" height="439" srcset="http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.43.43-1024x999.png 1024w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.43.43-300x293.png 300w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.43.43-768x749.png 768w, http://www.youngzy.com/wp-content/uploads/2019/08/屏幕快照-2019-08-26-下午11.43.43.png 1230w" sizes="(max-width: 450px) 100vw, 450px" style="box-sizing: border-box; border: 0px; vertical-align: middle; display: block; max-width: 100%; height: auto; margin: 5px 0px;" />
<p id="caption-attachment-1056" style="box-sizing: border-box; margin: 0px;">图7-push-force</p>
</div>
<p style="box-sizing: border-box; margin: 0px 0px 16px; color: #333333; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; background-color: #ffffff;">要特别注意的是，Reset慎用，跟Linux的&#8220;rm -rf /&#8221;有异曲同工之妙。<br /></p><a href="http://www.youngzy.com/blog/2019/08/git-difference-between-reset-and-revert-using-eclipse/" target="_blank">http://www.youngzy.com/blog/2019/08/git-difference-between-reset-and-revert-using-eclipse/</a><img src ="http://www.blogjava.net/paulwong/aggbug/435945.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2021-08-17 10:37 <a href="http://www.blogjava.net/paulwong/archive/2021/08/17/435945.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>git-stash用法小结</title><link>http://www.blogjava.net/paulwong/archive/2020/12/14/435748.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Mon, 14 Dec 2020 03:02:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2020/12/14/435748.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/435748.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2020/12/14/435748.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/435748.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/435748.html</trackback:ping><description><![CDATA[<h2>缘起</h2><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">今天在看一个bug，之前一个分支的版本是正常的，在新的分支上上加了很多日志没找到原因，希望回溯到之前的版本，确定下从哪个提交引入的问题，但是还不想把现在的修改提交，也不希望在Git上看到当前修改的版本（带有大量日志和调试信息）。因此呢，查查Git有没有提供类似功能，就找到了<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>的命令。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">综合下网上的介绍和资料，<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>（git储藏）可用于以下情形：</p><ul style="margin: 0px 0px 0px 30px; padding: 0px; word-break: break-all; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;"><li style="margin: 0px; padding: 0px; list-style: disc;">发现有一个类是多余的，想删掉它又担心以后需要查看它的代码，想保存它但又不想增加一个脏的提交。这时就可以考虑<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>。</li><li style="margin: 0px; padding: 0px; list-style: disc;">使用git的时候，我们往往使用分支（branch）解决任务切换问题，例如，我们往往会建一个自己的分支去修改和调试代码, 如果别人或者自己发现原有的分支上有个不得不修改的bug，我们往往会把完成一半的代码<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">commit</code>提交到本地仓库，然后切换分支去修改bug，改好之后再切换回来。这样的话往往log上会有大量不必要的记录。其实如果我们不想提交完成一半或者不完善的代码，但是却不得不去修改一个紧急Bug，那么使用<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>就可以将你当前未提交到本地（和服务器）的代码推入到Git的栈中，这时候你的工作区间和上一次提交的内容是完全一样的，所以你可以放心的修Bug，等到修完Bug，提交到服务器上后，再使用<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash apply</code>将以前一半的工作应用回来。</li><li style="margin: 0px; padding: 0px; list-style: disc;">经常有这样的事情发生，当你正在进行项目中某一部分的工作，里面的东西处于一个比较杂乱的状态，而你想转到其他分支上进行一些工作。问题是，你不想提交进行了一半的工作，否则以后你无法回到这个工作点。解决这个问题的办法就是<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>命令。储藏(stash)可以获取你工作目录的中间状态&#8212;&#8212;也就是你修改过的被追踪的文件和暂存的变更&#8212;&#8212;并将它保存到一个未完结变更的堆栈中，随时可以重新应用。</li></ul><h2><code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>用法</h2><h3>1. stash当前修改</h3><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;"><code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>会把所有未提交的修改（包括暂存的和非暂存的）都保存起来，用于后续恢复当前工作目录。<br style="margin: 0px; padding: 0px;" />比如下面的中间状态，通过<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>命令推送一个新的储藏，当前的工作目录就干净了。</p><pre style="margin-top: 10px; margin-bottom: 10px; padding: 0px; overflow: auto; color: #494949; background-color: #f4ede3;"><code sql"="" style="margin: auto; padding: 5px !important; line-height: 1.5 !important; vertical-align: middle; display: block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background: #ffffff; border: 1px solid #cccccc !important; border-radius: 3px !important; height: auto; color: #000000;">$ git status <br />On branch master <br />Changes to be committed:  <br /><br />new file:   style.css  <br /><br />Changes not staged for <span style="margin: 0px; padding: 0px; color: #0000ff;">commit</span>:  <br /><br />modified:   index.html  <br /><br />$ git stash Saved working <span style="margin: 0px; padding: 0px; color: #0000ff;">directory</span> <span style="margin: 0px; padding: 0px; color: #0000ff;">and</span> <span style="margin: 0px; padding: 0px; color: #0000ff;">index</span> state WIP <span style="margin: 0px; padding: 0px; color: #0000ff;">on</span> <span style="margin: 0px; padding: 0px; color: #0000ff;">master</span>: <span style="margin: 0px; padding: 0px;">5002</span>d47 our <span style="margin: 0px; padding: 0px; color: #0000ff;">new</span> homepage <br /><span style="margin: 0px; padding: 0px; color: #0000ff;">HEAD</span> <span style="margin: 0px; padding: 0px; color: #0000ff;">is</span> <span style="margin: 0px; padding: 0px; color: #0000ff;">now</span> <span style="margin: 0px; padding: 0px; color: #0000ff;">at</span> <span style="margin: 0px; padding: 0px;">5002</span>d47 our <span style="margin: 0px; padding: 0px; color: #0000ff;">new</span> homepage  <br /><br />$ git <span style="margin: 0px; padding: 0px; color: #0000ff;">status</span> <br /><span style="margin: 0px; padding: 0px; color: #0000ff;">On</span> branch <span style="margin: 0px; padding: 0px; color: #0000ff;">master</span> <span style="margin: 0px; padding: 0px; color: #0000ff;">nothing</span> <span style="margin: 0px; padding: 0px; color: #0000ff;">to</span> <span style="margin: 0px; padding: 0px; color: #0000ff;">commit</span>, working tree clean </code></pre><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">需要说明一点，stash是本地的，不会通过<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git push</code>命令上传到git server上。<br style="margin: 0px; padding: 0px;" />实际应用中推荐给每个stash加一个message，用于记录版本，使用<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash save</code>取代<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>命令。示例如下：</p><pre style="margin-top: 10px; margin-bottom: 10px; padding: 0px; overflow: auto; color: #494949; background-color: #f4ede3;"><code cmake"="" style="margin: auto; padding: 5px !important; line-height: 1.5 !important; vertical-align: middle; display: block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background: #ffffff; border: 1px solid #cccccc !important; border-radius: 3px !important; height: auto; color: #000000;">$ git stash save <span style="margin: 0px; padding: 0px; color: #a31515;">"test-cmd-stash"</span> <br />Saved working directory <span style="margin: 0px; padding: 0px; color: #0000ff;">and</span> index state <span style="margin: 0px; padding: 0px; color: #0000ff;">On</span> autoswitch: <span style="margin: 0px; padding: 0px; color: #0000ff;">test</span>-cmd-stash <br />HEAD 现在位于 <span style="margin: 0px; padding: 0px;">296</span>e8d4 <span style="margin: 0px; padding: 0px; color: #0000ff;">remove</span> unnecessary postion reset in onResume <span style="margin: 0px; padding: 0px; color: #0000ff;">function</span> <br />$ git stash <span style="margin: 0px; padding: 0px; color: #0000ff;">list</span> <br />stash@{<span style="margin: 0px; padding: 0px;">0</span>}: <span style="margin: 0px; padding: 0px; color: #0000ff;">On</span> autoswitch: <span style="margin: 0px; padding: 0px; color: #0000ff;">test</span>-cmd-stash  </code></pre><h3>2. 重新应用缓存的stash</h3><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">可以通过<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash pop</code>命令恢复之前缓存的工作目录，输出如下：</p><pre style="margin-top: 10px; margin-bottom: 10px; padding: 0px; overflow: auto; color: #494949; background-color: #f4ede3;"><code properties"="" style="margin: auto; padding: 5px !important; line-height: 1.5 !important; vertical-align: middle; display: block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background: #ffffff; border: 1px solid #cccccc !important; border-radius: 3px !important; height: auto; color: #000000;"><span style="margin: 0px; padding: 0px; color: #2b91af;">$</span> <span style="margin: 0px; padding: 0px; color: #a31515;">git status</span> <br /><span style="margin: 0px; padding: 0px; color: #ff0000;">On</span> <span style="margin: 0px; padding: 0px; color: #a31515;">branch master</span> <br /><span style="margin: 0px; padding: 0px; color: #ff0000;">nothing</span> <span style="margin: 0px; padding: 0px; color: #a31515;">to commit, working tree clean</span> <br /><span style="margin: 0px; padding: 0px; color: #2b91af;">$</span> <span style="margin: 0px; padding: 0px; color: #a31515;">git stash pop</span> <br /><span style="margin: 0px; padding: 0px; color: #ff0000;">On</span> <span style="margin: 0px; padding: 0px; color: #a31515;">branch master</span> <br /><span style="margin: 0px; padding: 0px; color: #ff0000;">Changes</span> <span style="margin: 0px; padding: 0px; color: #a31515;">to be committed:</span><br />     <span style="margin: 0px; padding: 0px; color: #ff0000;">new</span> <span style="margin: 0px; padding: 0px; color: #a31515;">file:   style.css</span>  <br /><br /><span style="margin: 0px; padding: 0px; color: #ff0000;">Changes</span> <span style="margin: 0px; padding: 0px; color: #a31515;">not staged for commit:<br /></span>      <span style="margin: 0px; padding: 0px; color: #ff0000;">modified</span>:   <span style="margin: 0px; padding: 0px; color: #a31515;">index.html</span>  <br /><span style="margin: 0px; padding: 0px; color: #ff0000;">Dropped</span> <span style="margin: 0px; padding: 0px; color: #a31515;">refs/stash@{0} (32b3aa1d185dfe6d57b3c3cc3b32cbf3e380cc6a)</span> </code></pre><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">这个指令将缓存堆栈中的第一个stash删除，并将对应修改应用到当前的工作目录下。<br style="margin: 0px; padding: 0px;" />你也可以使用<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash apply</code>命令，将缓存堆栈中的stash多次应用到工作目录中，但并不删除stash拷贝。命令输出如下：</p><pre style="margin-top: 10px; margin-bottom: 10px; padding: 0px; overflow: auto; color: #494949; background-color: #f4ede3;"><code properties"="" style="margin: auto; padding: 5px !important; line-height: 1.5 !important; vertical-align: middle; display: block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background: #ffffff; border: 1px solid #cccccc !important; border-radius: 3px !important; height: auto; color: #000000;"><span style="margin: 0px; padding: 0px; color: #2b91af;">$</span> <span style="margin: 0px; padding: 0px; color: #a31515;">git stash apply</span> <br /><span style="margin: 0px; padding: 0px; color: #ff0000;">On</span> <span style="margin: 0px; padding: 0px; color: #a31515;">branch master</span> <br /><span style="margin: 0px; padding: 0px; color: #ff0000;">Changes</span> <span style="margin: 0px; padding: 0px; color: #a31515;">to be committed:<br /></span>      <span style="margin: 0px; padding: 0px; color: #ff0000;">new</span> <span style="margin: 0px; padding: 0px; color: #a31515;">file:   style.css</span>  <br /><span style="margin: 0px; padding: 0px; color: #ff0000;">Changes</span> <span style="margin: 0px; padding: 0px; color: #a31515;">not staged for commit:<br /></span>      <span style="margin: 0px; padding: 0px; color: #ff0000;">modified</span>:   <span style="margin: 0px; padding: 0px; color: #a31515;">index.html</span> </code></pre><h3>3. 查看现有stash</h3><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">可以使用<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash list</code>命令，一个典型的输出如下：</p><pre style="margin-top: 10px; margin-bottom: 10px; padding: 0px; overflow: auto; color: #494949; background-color: #f4ede3;"><code perl"="" style="margin: auto; padding: 5px !important; line-height: 1.5 !important; vertical-align: middle; display: block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background: #ffffff; border: 1px solid #cccccc !important; border-radius: 3px !important; height: auto; color: #000000;">$ git stash list <br />stash@{0}: WIP on master: <span style="margin: 0px; padding: 0px;">04</span>9d078 added the <span style="margin: 0px; padding: 0px; color: #0000ff;">index</span> file <br />stash@{1}: WIP on master: c264051 Revert <span style="margin: 0px; padding: 0px; color: #a31515;">"added file_size"</span> <br />stash@{2}: WIP on master: <span style="margin: 0px; padding: 0px;">21</span>d80a5 added number to <span style="margin: 0px; padding: 0px; color: #0000ff;">log</span> </code></pre><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">在使用<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash apply</code>命令时可以通过名字指定使用哪个stash，默认使用最近的stash（即stash@{0}）。</p><h3>4. 移除stash</h3><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">可以使用<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash drop</code>命令，后面可以跟着stash名字。下面是一个示例：</p><pre style="margin-top: 10px; margin-bottom: 10px; padding: 0px; overflow: auto; color: #494949; background-color: #f4ede3;"><code perl"="" style="margin: auto; padding: 5px !important; line-height: 1.5 !important; vertical-align: middle; display: block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background: #ffffff; border: 1px solid #cccccc !important; border-radius: 3px !important; height: auto; color: #000000;">$ git stash list <br />stash@{0}: WIP on master: <span style="margin: 0px; padding: 0px;">04</span>9d078 added the <span style="margin: 0px; padding: 0px; color: #0000ff;">index</span> file <br />stash@{1}: WIP on master: c264051 Revert <span style="margin: 0px; padding: 0px; color: #a31515;">"added file_size"</span> <br />stash@{2}: WIP on master: <span style="margin: 0px; padding: 0px;">21</span>d80a5 added number to <span style="margin: 0px; padding: 0px; color: #0000ff;">log</span> <br />$ git stash drop stash@{0} <br />Dropped stash@{0} (<span style="margin: 0px; padding: 0px;">364</span>e91f3f268f0900bc3ee613f9f733e82aaed43) </code></pre><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">或者使用<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash clear</code>命令，删除所有缓存的stash。</p><h3>5. 查看指定stash的diff</h3><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">可以使用<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash show</code>命令，后面可以跟着stash名字。示例如下：</p><pre style="margin-top: 10px; margin-bottom: 10px; padding: 0px; overflow: auto; color: #494949; background-color: #f4ede3;"><code yaml"="" style="margin: auto; padding: 5px !important; line-height: 1.5 !important; vertical-align: middle; display: block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background: #ffffff; border: 1px solid #cccccc !important; border-radius: 3px !important; height: auto; color: #000000;"><span style="margin: 0px; padding: 0px; color: #a31515;">$</span> <span style="margin: 0px; padding: 0px; color: #a31515;">git</span> <span style="margin: 0px; padding: 0px; color: #a31515;">stash</span> <span style="margin: 0px; padding: 0px; color: #a31515;">show<br /></span>  <span style="margin: 0px; padding: 0px; color: #a31515;">index.html</span> <span style="margin: 0px; padding: 0px; color: #a31515;">|</span> <span style="margin: 0px; padding: 0px;">1</span> <span style="margin: 0px; padding: 0px; color: #a31515;">+<br /></span>  <span style="margin: 0px; padding: 0px; color: #a31515;">style.css</span> <span style="margin: 0px; padding: 0px; color: #a31515;">|</span> <span style="margin: 0px; padding: 0px;">3</span> <span style="margin: 0px; padding: 0px; color: #a31515;">+++<br /></span>  <span style="margin: 0px; padding: 0px;">2</span> <span style="margin: 0px; padding: 0px; color: #a31515;">files</span> <span style="margin: 0px; padding: 0px; color: #a31515;">changed,</span> <span style="margin: 0px; padding: 0px;">4</span> <span style="margin: 0px; padding: 0px; color: #a31515;">insertions(+)</span> </code></pre><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">在该命令后面添加<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">-p</code>或<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">--patch</code>可以查看特定stash的全部diff，如下：</p><pre style="margin-top: 10px; margin-bottom: 10px; padding: 0px; overflow: auto; color: #494949; background-color: #f4ede3;"><code diff"="" style="margin: auto; padding: 5px !important; line-height: 1.5 !important; vertical-align: middle; display: block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background: #ffffff; border: 1px solid #cccccc !important; border-radius: 3px !important; height: auto; color: #000000;">$ git stash show -p <br />diff --git a/style.css b/style.css <br />new file mode 100644 <br />index 0000000..d92368b <br /><span style="margin: 0px; padding: 0px; color: #008000;">--- /dev/null</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;">+++ b/style.css</span> <span style="margin: 0px; padding: 0px; color: #2b91af;">@@ -0,0 +1,3 @@</span> <br /><span style="margin: 0px; padding: 0px; color: #a31515;">+* {</span> <br /><span style="margin: 0px; padding: 0px; color: #a31515;">+  text-decoration: blink;</span> <br /><span style="margin: 0px; padding: 0px; color: #a31515;">+}</span> <br />diff --git a/index.html b/index.html <br />index 9daeafb..ebdcbd2 100644 <br /><span style="margin: 0px; padding: 0px; color: #008000;">--- a/index.html</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;">+++ b/index.html</span> <br />@@ -1 +1,2 @@ <br /><span style="margin: 0px; padding: 0px; color: #a31515;">+&lt;link rel="stylesheet" href="style.css"/&gt;</span> </code></pre><h3>6. 从stash创建分支</h3><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">如果你储藏了一些工作，暂时不去理会，然后继续在你储藏工作的分支上工作，你在重新应用工作时可能会碰到一些问题。如果尝试应用的变更是针对一个你那之后修改过的文件，你会碰到一个归并冲突并且必须去化解它。如果你想用更方便的方法来重新检验你储藏的变更，你可以运行 git stash branch，这会创建一个新的分支，检出你储藏工作时的所处的提交，重新应用你的工作，如果成功，将会丢弃储藏。</p><pre style="margin-top: 10px; margin-bottom: 10px; padding: 0px; overflow: auto; color: #494949; background-color: #f4ede3;"><code coffeescript"="" style="margin: auto; padding: 5px !important; line-height: 1.5 !important; vertical-align: middle; display: block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background: #ffffff; border: 1px solid #cccccc !important; border-radius: 3px !important; height: auto; color: #000000;">$ git stash branch testchanges <br />Switched to a <span style="margin: 0px; padding: 0px; color: #0000ff;">new</span> branch <span style="margin: 0px; padding: 0px; color: #a31515;">"testchanges"</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;"># On branch testchanges</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;"># Changes to be committed:</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;">#   (use "git reset HEAD &lt;file&gt;..." to unstage)</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;">#</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;">#      modified:   index.html</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;">#</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;"># Changes not staged for commit:</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;">#   (use "git add &lt;file&gt;..." to update what will be committed)</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;">#</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;">#      modified:   lib/simplegit.rb</span> <br /><span style="margin: 0px; padding: 0px; color: #008000;">#</span> <br />Dropped refs/stash@{<span style="margin: 0px; padding: 0px;">0</span>} (f0dfc4d5dc332d1cee34a634182e168c4efc3359) </code></pre><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">这是一个很棒的捷径来恢复储藏的工作然后在新的分支上继续当时的工作。</p><h3>7. 暂存未跟踪或忽略的文件</h3><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">默认情况下，<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>会缓存下列文件：</p><ul style="margin: 0px 0px 0px 30px; padding: 0px; word-break: break-all; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;"><li style="margin: 0px; padding: 0px; list-style: disc;">添加到暂存区的修改（staged changes）</li><li style="margin: 0px; padding: 0px; list-style: disc;">Git跟踪的但并未添加到暂存区的修改（unstaged changes）</li></ul><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">但不会缓存一下文件：</p><ul style="margin: 0px 0px 0px 30px; padding: 0px; word-break: break-all; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;"><li style="margin: 0px; padding: 0px; list-style: disc;">在工作目录中新的文件（untracked files）</li><li style="margin: 0px; padding: 0px; list-style: disc;">被忽略的文件（ignored files）</li></ul><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;"><code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>命令提供了参数用于缓存上面两种类型的文件。使用<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">-u</code>或者<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">--include-untracked</code>可以stash untracked文件。使用<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">-a</code>或者<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">--all</code>命令可以stash当前目录下的所有修改。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">至于<code style="margin: 1px 5px; padding: 0px 5px !important; line-height: 1.8; vertical-align: middle; display: inline-block; overflow-x: auto; font-family: &quot;Courier New&quot;, sans-serif !important; font-size: 12px !important; background-color: #f5f5f5 !important; border: 1px solid #cccccc !important; border-radius: 3px !important;">git stash</code>的其他命令建议参考Git manual。</p><h2>小结</h2><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;">git提供的工具很多，恰好用到就可以深入了解下。更方便的开发与工作的。</p><h3>参考资料</h3><ol style="margin: 0px; padding: 0px 0px 0px 40px; color: #494949; font-family: Arial, Helvetica, sans-serif; background-color: #f4ede3;"><li style="margin: 0px; padding: 0px; list-style: decimal;"><a href="https://git-scm.com/book/zh/v1/Git-%E5%B7%A5%E5%85%B7-%E5%82%A8%E8%97%8F%EF%BC%88Stashing%EF%BC%89" target="_blank" style="margin: 0px; padding: 0px; color: #494949;">6.3 Git工具-储藏（Stashing）</a></li><li style="margin: 0px; padding: 0px; list-style: decimal;"><a href="http://blog.hanfeisun.info/2012/12/git-stash-adventure/" target="_blank" style="margin: 0px; padding: 0px; color: #494949;">Git Stash 历险记</a></li><li style="margin: 0px; padding: 0px; list-style: decimal;"><a href="http://www.cppblog.com/deercoder/archive/2011/11/13/160007.aspx" target="_blank" style="margin: 0px; padding: 0px; color: #494949;">Git Stash用法</a></li><li style="margin: 0px; padding: 0px; list-style: decimal;"><a href="https://www.atlassian.com/git/tutorials/git-stash/" target="_blank" style="margin: 0px; padding: 0px; color: #494949;">Git Stash</a></li></ol><img src ="http://www.blogjava.net/paulwong/aggbug/435748.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2020-12-14 11:02 <a href="http://www.blogjava.net/paulwong/archive/2020/12/14/435748.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在ECLIPSE中切换到新建的分支</title><link>http://www.blogjava.net/paulwong/archive/2020/09/24/435671.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Thu, 24 Sep 2020 07:16:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2020/09/24/435671.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/435671.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2020/09/24/435671.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/435671.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/435671.html</trackback:ping><description><![CDATA[如果已经在ECLIPSE中CLONE了GIT的项目，这时当GIT中又新建了项目，ECLIPSE无法切换到这新建的项目，解决办法：<br />
<br />
<br />
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: var(--s-prose-spacing); margin-left: 0px; padding: 0px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; font-size: 15px; vertical-align: baseline; box-sizing: inherit; clear: both; color: #242729; background-color: #ffffff;">In the&nbsp;<strong style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;"><em style="margin: 0px; padding: 0px; border: 0px; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;">Git Repositories</em></strong>&nbsp;view:</p>
<ol style="margin: 0px 0px 0px 30px; padding: 0px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; font-size: 15px; vertical-align: baseline; list-style-position: initial; list-style-image: initial; box-sizing: inherit; color: #242729; background-color: #ffffff;">
     <li style="margin-top: 0px; margin-right: 0px; margin-bottom: var(--s-prose-spacing-condensed); margin-left: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; overflow-wrap: break-word;"><strong style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;">Right-click the repository</strong>&nbsp;and choose&nbsp;<strong style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;"><em style="margin: 0px; padding: 0px; border: 0px; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;">Fetch from Upstream</em></strong></li>
     <li style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; overflow-wrap: break-word;">If the new branch will not shown up below&nbsp;<em style="margin: 0px; padding: 0px; border: 0px; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;">Branches/Remote Tracking</em>, you have to configure fetch:
     <ol style="margin-top: var(--s-prose-spacing-condensed); margin-right: 0px; margin-bottom: 0px; margin-left: 30px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; list-style-position: initial; list-style-image: initial; box-sizing: inherit;">
         <li style="margin-top: 0px; margin-right: 0px; margin-bottom: var(--s-prose-spacing-condensed); margin-left: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; overflow-wrap: break-word;"><strong style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;">Right-click the fetch node below&nbsp;<em style="margin: 0px; padding: 0px; border: 0px; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;">Remotes/origin</em></strong>&nbsp;and choose&nbsp;<strong style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;"><em style="margin: 0px; padding: 0px; border: 0px; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;">Configure Fetch...</em></strong></li>
         <li style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; overflow-wrap: break-word;">In the&nbsp;<em style="margin: 0px; padding: 0px; border: 0px; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;">Configure Fetch</em>&nbsp;make sure there is only the single&nbsp;<em style="margin: 0px; padding: 0px; border: 0px; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;">Ref mapping</em>&nbsp;(assuming the remote is named&nbsp;<code style="margin: 0px; padding: 2px 4px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; font-size: 13px; vertical-align: baseline; box-sizing: inherit; background-color: var(--black-075); white-space: pre-wrap; color: var(--black-800); border-radius: 3px;">origin</code>)&nbsp;<strong style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;"><code style="margin: 0px; padding: 2px 4px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; font-size: 13px; vertical-align: baseline; box-sizing: inherit; background-color: var(--black-075); white-space: pre-wrap; color: var(--black-800); border-radius: 3px;">+refs/heads/*:refs/remotes/origin/*</code></strong>:<br style="box-sizing: inherit;" />
         <a href="https://i.stack.imgur.com/FeLz7.png" rel="noreferrer" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit; cursor: pointer;"><img src="https://i.stack.imgur.com/FeLz7.png" alt="Configure fetch" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; vertical-align: bottom; box-sizing: inherit; max-width: 100%;" /></a></li>
     </ol>
     </li>
</ol><br />这时再次Fetch from upstream，则新建的项目再次重现：Git Repositories View--&gt;Branches--&gt;Remote Checking中。<br />双击新的分支，选：Check out as New Local Branch即可。<br /><br /><a href="https://stackoverflow.com/questions/47390703/how-do-i-get-a-new-branch-to-show-up-in-eclipse-git-remote-tracking/47391183" target="_blank">https://stackoverflow.com/questions/47390703/how-do-i-get-a-new-branch-to-show-up-in-eclipse-git-remote-tracking/47391183</a><img src ="http://www.blogjava.net/paulwong/aggbug/435671.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2020-09-24 15:16 <a href="http://www.blogjava.net/paulwong/archive/2020/09/24/435671.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Git Cherry Pick</title><link>http://www.blogjava.net/paulwong/archive/2020/07/23/435609.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Thu, 23 Jul 2020 12:21:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2020/07/23/435609.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/435609.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2020/07/23/435609.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/435609.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/435609.html</trackback:ping><description><![CDATA[<a href="https://www.atlassian.com/git/tutorials/cherry-pick" target="_blank">https://www.atlassian.com/git/tutorials/cherry-pick</a><br /><br /><br /><img src ="http://www.blogjava.net/paulwong/aggbug/435609.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2020-07-23 20:21 <a href="http://www.blogjava.net/paulwong/archive/2020/07/23/435609.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>GIT资源</title><link>http://www.blogjava.net/paulwong/archive/2020/06/04/435480.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Thu, 04 Jun 2020 02:38:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2020/06/04/435480.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/435480.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2020/06/04/435480.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/435480.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/435480.html</trackback:ping><description><![CDATA[<br /><a href="http://jartto.wang/tags/git/" target="_blank">http://jartto.wang/tags/git/</a><br /><br /><img src ="http://www.blogjava.net/paulwong/aggbug/435480.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2020-06-04 10:38 <a href="http://www.blogjava.net/paulwong/archive/2020/06/04/435480.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>彻底搞懂 Git-Rebase</title><link>http://www.blogjava.net/paulwong/archive/2020/06/04/435479.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Thu, 04 Jun 2020 02:37:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2020/06/04/435479.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/435479.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2020/06/04/435479.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/435479.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/435479.html</trackback:ping><description><![CDATA[根据分支1新建了功能分支1，并在此上开发一段时间，后来分支1被别人提交了代码，因此分支1比功能分支1要新，这时，可以将功能分支1与分支1进行合并，但会多出很多COMMIT，这时就出现了rebase，<br />
GIT会将功能分支1上的所有COMMIT另存一个文件，回退到分支1原始状态，再更新至当前分支1的状态，再把另存文件的COMMIT执行一遍，就成了已经合并的新的功能分支1。<br />
<br />
<a href="http://jartto.wang/2018/12/11/git-rebase/" target="_blank">http://jartto.wang/2018/12/11/git-rebase/</a><br /><br />GIT使用rebase和merge的正确姿势<br /><a href="https://zhuanlan.zhihu.com/p/34197548" target="_blank">https://zhuanlan.zhihu.com/p/34197548</a><br /><br />git merge和git rebase的区别, 切记：永远用rebase<br /><a href="https://zhuanlan.zhihu.com/p/75499871" target="_blank">https://zhuanlan.zhihu.com/p/75499871</a><br /><br /><br /><br /><img src ="http://www.blogjava.net/paulwong/aggbug/435479.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2020-06-04 10:37 <a href="http://www.blogjava.net/paulwong/archive/2020/06/04/435479.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Git版本控制与工作流</title><link>http://www.blogjava.net/paulwong/archive/2019/11/26/434929.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Tue, 26 Nov 2019 03:21:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2019/11/26/434929.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/434929.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2019/11/26/434929.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/434929.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/434929.html</trackback:ping><description><![CDATA[<img src="https://upload-images.jianshu.io/upload_images/166109-e49ba9e2ca4e3dfd.gif?imageMogr2/auto-orient/strip|imageView2/2/w/844/format/webp" width="844" height="400" alt="" /><br /><br /><a href="https://www.jianshu.com/p/67afe711c731" target="_blank">https://www.jianshu.com/p/67afe711c731</a><br /><img src ="http://www.blogjava.net/paulwong/aggbug/434929.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2019-11-26 11:21 <a href="http://www.blogjava.net/paulwong/archive/2019/11/26/434929.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>GIT TAG</title><link>http://www.blogjava.net/paulwong/archive/2019/11/26/434928.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Tue, 26 Nov 2019 02:57:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2019/11/26/434928.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/434928.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2019/11/26/434928.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/434928.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/434928.html</trackback:ping><description><![CDATA[GIT中的tag 相当于是一个快照，是不能更改它的代码的。<br />如果要在 tag 代码的基础上做修改，你需要一个分支：&nbsp;<br /><br />通常TAG与软件版本相对应，即TAG名称用软件版本号来表示。<br /><br />软件版本的格式规范：<br />版本格式：主版本号.次版本号.修订号，版本号递增规则如下：<br /><br />主版本号：当你做了不兼容的 API 修改，<br />次版本号：当你做了向下兼容的功能性新增，<br />修订号：当你做了向下兼容的问题修正。<br /><br />先行版本号及版本编译信息可以加到&#8220;主版本号.次版本号.修订号&#8221;的后面，作为延伸。<br /><br />Git打标签与版本控制规范<br /><a href="https://juejin.im/post/5b0531c6f265da0b7f44eb8c" target="_blank">https://juejin.im/post/5b0531c6f265da0b7f44eb8c</a><br /><br />git切换到某个tag<br /><a href="https://blog.csdn.net/DinnerHowe/article/details/79082769" target="_blank">https://blog.csdn.net/DinnerHowe/article/details/79082769</a><br /><br />git cherry-pick 把提交到A分支的部分commit 再提交到B分支上<br /><a href="http://yijiebuyi.com/blog/0e65f4a59a1cfa05c5b30ccb6c2f413d.html" target="_blank">http://yijiebuyi.com/blog/0e65f4a59a1cfa05c5b30ccb6c2f413d.html</a><br /><br /><img src ="http://www.blogjava.net/paulwong/aggbug/434928.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2019-11-26 10:57 <a href="http://www.blogjava.net/paulwong/archive/2019/11/26/434928.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse使用git最简易流程</title><link>http://www.blogjava.net/paulwong/archive/2016/05/15/430510.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Sun, 15 May 2016 10:17:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2016/05/15/430510.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/430510.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2016/05/15/430510.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/430510.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/430510.html</trackback:ping><description><![CDATA[<div id="cnblogs_post_body" style="margin-bottom: 20px; word-break: break-word; font-family: 微软雅黑, 宋体, Arial; font-size: 15px; line-height: normal; background-color: #ffffff;"><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">git有诸多好处，网上都说的很清楚了，在这里我不再赘述。对于我来说，私下里想做一些项目，而又不能很好的保存自己的代码和进行版本控制，这时候，就用到了git。下面，就以我个人为例讲讲git从0开始如何安装使用。</p><h3><strong><span style="font-size: 18pt;">Step1 准备工作</span></strong></h3><p align="left" style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">msysgit，下载地址为<a title="http://msysgit.github.io/" href="http://msysgit.github.io/" style="color: #709070; text-decoration: none;">http://msysgit.github.io/</a>。</p><p align="left" style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">Eclipse&nbsp;<em>IDE</em>&nbsp;<em>for</em>&nbsp;<em>Java</em>&nbsp;EE Developers（必须是这个，自带Egit，或者自行安装Egit插件），在Eclipse官网下载，地址<a title="http://www.eclipse.org/downloads/" href="http://www.eclipse.org/downloads/" style="color: #709070; text-decoration: none;">http://www.eclipse.org/downloads/</a>。</p><p align="left" style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">github账号，github官网注册一个，地址<a title="https://github.com/" href="https://github.com/" style="color: #709070; text-decoration: none;">https://github.com/</a>。</p><p align="left" style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">廖雪峰的git教程，地址为<a title="http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000" href="http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000" style="color: #709070; text-decoration: none;">http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000</a>，讲得很好，我大概花了3个晚上的时间看，如果仅仅是为了安装上，可以先暂时略过，后面再看。</p><h3><strong><span style="font-size: 18pt;">Step2 msysgit安装</span></strong></h3><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">一路next就行，注意可能会遇到360的拦截（该死，点击允许本程序所有操作或者安装前就退出360即可）。</p><h3><strong><span style="font-size: 18pt;">Step3 git用户名和邮箱配置</span></strong></h3><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">单击开始菜单，打开Git Bush，</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120177481512.jpg" style="color: #709070; text-decoration: none;"><img title="教程1" src="http://images.cnitblog.com/blog/465427/201409/252120186077939.jpg" alt="教程1" width="702" height="311" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">输入以下命令</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">git config --global user.name "Your Name"</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">git config --global user.email&nbsp;<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#101;&#109;&#97;&#105;&#108;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;" style="color: #709070; text-decoration: none;">email@example.com</a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">用户名和邮箱替换为自己的，为本台机器所有仓库指定用户名和email地址。</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">&nbsp;</p><h3><strong><span style="font-size: 18pt;">Step4 创建SSH Key</span></strong></h3><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">因为本地git仓库和远程的github仓库之间是通过ssh加密的，所以，还需要创建一个SSH Key。</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">输入以下命令</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">ssh-keygen -t rsa -C&nbsp;<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#121;&#111;&#117;&#114;&#101;&#109;&#97;&#105;&#108;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;" style="color: #709070; text-decoration: none;">youremail@example.com</a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">同样将邮箱替换为自己的。在路径C盘-&gt;用户-&gt;用户名，找到.ssh文件夹，打开就可以看到两个文件id_rsa和id_rsa.pub，</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">打开id_rsa.pub，将其中的内容复制下来（这就相当于一把钥匙，持有钥匙的人可以访问你的内容，下一个小结讲解这把钥匙的用途），下面是我的</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120194044583.png" style="color: #709070; text-decoration: none;"><img title="教程2" src="http://images.cnitblog.com/blog/465427/201409/252120209821099.png" alt="教程2" width="540" height="364" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">&nbsp;</p><h3><strong><span style="font-size: 18pt;">Step5 与github上的仓库相关联</span></strong></h3><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">注册一个github账号</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">注册完成之后，点击右上角的settings（就是那个齿轮，设置的图标）</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120218266457.jpg" style="color: #709070; text-decoration: none;"><img title="教程3" src="http://images.cnitblog.com/blog/465427/201409/252120228101158.jpg" alt="教程3" width="693" height="370" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">进入设置页面</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120238898586.png" style="color: #709070; text-decoration: none;"><img title="image" src="http://images.cnitblog.com/blog/465427/201409/252120245926202.png" alt="image" width="610" height="322" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">选SSH Keys，点击add SSH key，就可以添加了，title随便填写，将从id_rsa.pub中复制的内容粘贴到这里。从此，gitgub仓库就能够识别你本地的仓库了。也就是说，你离将本地代码推送到github上，或者将github上的代码克隆到本地，就只差一步了。（可参考廖雪峰前辈的教程先进行在非Eclipse下的操作，更有感觉）</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">&nbsp;</p><h3><strong><span style="font-size: 18pt;">Step6 Egit的使用</span></strong></h3><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">首先，登入你的github账号，点击加号，选择New repositrory，创建一个新的仓库，如图所示。</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120271854661.png" style="color: #709070; text-decoration: none;"><img title="教程6" src="http://images.cnitblog.com/blog/465427/201409/252120313266093.png" alt="教程6" width="757" height="405" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">名字叫做test2，其他都默认就好。</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">点击绿色按钮创建，就创建好了一个github仓库。</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120325296092.png" style="color: #709070; text-decoration: none;"><img title="教程7" src="http://images.cnitblog.com/blog/465427/201409/252120368428811.png" alt="教程7" width="759" height="393" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">将地址复制下来，保存好备用。</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">打开Eclipse，像平常一样，新建一个web工程，或者其他你常用的工程。我这里工程叫做scott</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120385608369.jpg" style="color: #709070; text-decoration: none;"><img title="{4$7`FVS]283EW(~80FR(JT" src="http://images.cnitblog.com/blog/465427/201409/252120388895169.jpg" alt="{4$7`FVS]283EW(~80FR(JT" width="309" height="376" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">右击项目，选择Team-&gt;Share Project，弹出如下窗口。</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120392489213.png" style="color: #709070; text-decoration: none;"><img title="image" src="http://images.cnitblog.com/blog/465427/201409/252120396851813.png" alt="image" width="622" height="377" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">选择git，next，在弹出的界面上，&#9312;先勾选Use or create&#8230;&#8230;，&#9313;createrepository，&#9314;勾选工程，&#9315;finish。</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120406701214.png" style="color: #709070; text-decoration: none;"><img title="教程8" src="http://images.cnitblog.com/blog/465427/201409/252120417953658.png" alt="教程8" width="659" height="345" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">这时候，你就创建好了一个git工程，右击工程，选择Team，你可以像svn一样进行commit，synchronize等操作，但是，remote操作中，push是灰色的，表示还不能将代码推送到github仓库上去。</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120427958829.png" style="color: #709070; text-decoration: none;"><img title="教程10" src="http://images.cnitblog.com/blog/465427/201409/252120444209359.png" alt="教程10" width="675" height="376" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">这时，打开Git Repository视图（具体怎么打开百度去，这都是基本常识了）</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120455926817.png" style="color: #709070; text-decoration: none;"><img title="教程11" src="http://images.cnitblog.com/blog/465427/201409/252120462792960.png" alt="教程11" width="697" height="356" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">右键选择Create Remote，点OK</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120466543775.png" style="color: #709070; text-decoration: none;"><img title="image" src="http://images.cnitblog.com/blog/465427/201409/252120473424619.png" alt="image" width="420" height="340" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">点击Change，弹出如下界面</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120477018662.png" style="color: #709070; text-decoration: none;"><img title="image" src="http://images.cnitblog.com/blog/465427/201409/252120480769477.png" alt="image" width="422" height="408" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">URI输入之前在github上拷贝的地址，下面的内容会自动填上。你只需要再填上github上的用户名和密码即可。finish，save。</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">接下来的几步就简单了，在项目里面随便写点代码，然后先将新增的代码提交到本地，例如，将cat类，先add to index，然后commit。这时候，右键工程，Team-&gt;remote中就有了push选项，意味着你可以将本地代码保存在github中了。祝贺你！</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><a href="http://images.cnitblog.com/blog/465427/201409/252120489518377.png" style="color: #709070; text-decoration: none;"><img title="教程12" src="http://images.cnitblog.com/blog/465427/201409/252120499514550.png" alt="教程12" width="597" height="338" border="0" style="border: 0px; max-width: 900px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; background-image: none;" /></a></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">点击Push，点击add All Branches Spec，将本地版本库添加，然后Finish，后面一路Next，再次查看github，可以看到代码已经成功推送。</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><img src="http://images.cnitblog.com/blog/465427/201409/252131006703961.png" alt="" style="border: 0px; max-width: 900px; margin: 10px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;">最后，看看我们在github上的代码吧！</p><p style="margin-top: 10px; margin-bottom: 10px; line-height: 24px;"><img src="http://images.cnitblog.com/blog/465427/201409/252134467485129.png" alt="" style="border: 0px; max-width: 900px; margin: 10px;" /></p></div><div id="MySignature" style="font-family: 微软雅黑, 宋体, Arial; font-size: 15px; line-height: normal; background-color: #ffffff;"><p id="PSignature" style="margin: 7px 0px; line-height: 20px; border: 1px dashed #e0e0e0; padding: 10px 10px 10px 60px; font-size: 12px; background: url(http://pic002.cnblogs.com/images/2010/36987/2010092119181033.png) 2% 50% no-repeat #fffaea;">作者：&nbsp;<a target="_blank" href="http://home.cnblogs.com/ZhangWanFan" style="color: #709070; text-decoration: none;">张万帆</a>&nbsp;<br />欢迎任何形式的转载，但请务必注明出处。</p></div><img src ="http://www.blogjava.net/paulwong/aggbug/430510.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2016-05-15 18:17 <a href="http://www.blogjava.net/paulwong/archive/2016/05/15/430510.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse上安装GIT插件EGit及使用</title><link>http://www.blogjava.net/paulwong/archive/2016/05/15/430509.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Sun, 15 May 2016 09:46:00 GMT</pubDate><guid>http://www.blogjava.net/paulwong/archive/2016/05/15/430509.html</guid><wfw:comment>http://www.blogjava.net/paulwong/comments/430509.html</wfw:comment><comments>http://www.blogjava.net/paulwong/archive/2016/05/15/430509.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/paulwong/comments/commentRss/430509.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/paulwong/services/trackbacks/430509.html</trackback:ping><description><![CDATA[<p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><span style="font-size: medium;"><strong>一、Eclipse上安装GIT插件EGit</strong></span></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp; &nbsp; &nbsp; Eclipse的版本eclipse-java-helios-SR2-win32.zip（在Eclipse3.3版本找不到对应的 EGit插件，无法安装）</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp; &nbsp; &nbsp;<img height="300" width="564" alt="" src="http://dl.iteye.com/upload/attachment/0078/1229/bd86f8f3-4330-39cd-9123-ee09969e7880.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="514" width="670" alt="" src="http://dl.iteye.com/upload/attachment/0078/1233/1edcc324-8b29-30ac-8f06-f749f17c22e1.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">EGit插件地址：http://download.eclipse.org/egit/updates</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">OK，随后连续下一步默认安装就可以，安装后进行重启Eclipse</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><strong><span style="font-size: medium;">二、在Eclipse中配置EGit</span></strong></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">准备工作：需要在https://github.com 上注册账号</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><span style="color: #333333; line-height: 26px;">Preferences &gt; Team &gt; Git &gt; Configuration</span></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="533" width="848" alt="" src="http://dl.iteye.com/upload/attachment/0078/1244/94d03050-16e4-3e2f-bf1c-38b313c0f3e9.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">这里的user.name 是你在https://github.com上注册用户名</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="543" width="851" alt="" src="http://dl.iteye.com/upload/attachment/0078/1246/92d49783-11af-3a2b-8d29-b18031ad842d.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">user.email是你在github上绑定的邮箱。在这里配置user.name即可</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><strong><span style="font-size: medium;">三、新建项目，并将代码提交到本地的GIT仓库中</span></strong></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">1、新建项目 git_demo，并新建HelloWorld.java类</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="301" width="511" alt="" src="http://dl.iteye.com/upload/attachment/0078/1249/8773d6dc-6a4b-3b9f-9430-4f45e4d4aff2.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">2、将git_demo项目提交到本地仓库，如下图</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="602" width="650" alt="" src="http://dl.iteye.com/upload/attachment/0078/1251/3dc852e7-aaf7-3905-b746-375be1c7434d.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="418" width="551" alt="" src="http://dl.iteye.com/upload/attachment/0078/1255/3e67564c-9256-3760-a261-e458eb51a201.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="416" width="751" alt="" src="http://dl.iteye.com/upload/attachment/0078/1258/e5d2d04c-3b8d-39de-9306-94df650ff22b.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><span style="color: #333333; font-family: Arial; line-height: 26px;">到此步，就成功创建GIT仓库。但</span><span style="color: #333333; font-family: Arial; line-height: 26px;">文件夹处于untracked状态（</span><span style="color: #333333; font-family: Arial; line-height: 26px;">文件夹中的符号&#8221;?&#8221;表示</span><span style="color: #333333; font-family: Arial; line-height: 26px;">），下面我们需要提交代码到本地仓库，如下图</span></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="573" width="714" alt="" src="http://dl.iteye.com/upload/attachment/0078/1261/38a43904-02f2-382c-a7f1-2b5bbee809ee.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="670" width="648" alt="" src="http://dl.iteye.com/upload/attachment/0078/1263/0abf28b3-62ab-3358-9270-2028dfa43f6b.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="263" width="272" alt="" src="http://dl.iteye.com/upload/attachment/0078/1265/8cf22e74-4af3-346f-b7cd-98b85ecb4463.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">OK，这样代码提交到了本地仓库</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><strong><span style="font-size: medium;">四：将本地代码提交到远程的GIT仓库中</span></strong></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">准备工作：在https://github.com上创建仓库</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="120" width="720" alt="" src="http://dl.iteye.com/upload/attachment/0078/1272/e65f130b-ebf2-3957-bcb6-cdad67c8432b.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="533" width="603" alt="" src="http://dl.iteye.com/upload/attachment/0078/1276/8371af04-8c4e-355a-803c-9418b9016f56.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">点击&#8220;Create repository&#8221; ，ok,这样在github上的仓库就创建好了。</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">注意创建好远程仓库后，点击进去，此时可以看到一个HTTP地址，如红线框，这个是你http协议的远程仓库地址</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="198" width="931" alt="" src="http://dl.iteye.com/upload/attachment/0078/1278/73653a2f-4f74-34e5-b18e-fc02182c4634.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">准备工作做好了，那开始将代码提交到远程仓库吧</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="583" width="879" alt="" src="http://dl.iteye.com/upload/attachment/0078/1282/f5389b68-9b47-396c-9e9f-782356943ddb.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="643" width="610" alt="" src="http://dl.iteye.com/upload/attachment/0078/1284/22beeac3-46dd-3a1e-bc82-6fe795bc7159.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="639" width="607" alt="" src="http://dl.iteye.com/upload/attachment/0078/1286/b5b24fe6-c674-3776-9ab8-87435a2f2f4b.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="629" width="607" alt="" src="http://dl.iteye.com/upload/attachment/0078/1288/84a478c0-5b4a-3137-b5f6-945fee7826a9.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="632" width="610" alt="" src="http://dl.iteye.com/upload/attachment/0078/1290/92c0c338-3dc5-364e-ab35-2a0b3a6c576c.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="444" width="647" alt="" src="http://dl.iteye.com/upload/attachment/0078/1292/312c7b8b-9e08-38e0-abcb-f7403cedf6f6.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">OK，这样提交远程GIT就完成了，可以在https://github.com核对一下代码是否已经提交</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><img height="441" width="959" alt="" src="http://dl.iteye.com/upload/attachment/0078/1294/f822ddf9-b515-3587-8429-191cfb549f08.jpg" style="border: 0px;" /></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><strong><span style="font-size: medium;">注意的问题</span></strong></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><span style="color: #333333; font-family: Arial; line-height: 26px;">&nbsp; &nbsp;如果是首次提交会第一步：先在本地建立一个一样的仓库，称本地仓库。</span></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><span style="color: #333333; font-family: Arial; line-height: 26px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 第二步：在本地进行commit操作将把更新提交到本地仓库；</span></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><span style="color: #333333; font-family: Arial; line-height: 26px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 第三步： 将服务器端的更新pull到本地仓库进行合并，最后将合并好的本地仓库push到服务器端，这样就进行了一次远程提交。</span></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp; 如果非首次提交同样的道理</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 第一步：将修改的代码commit操作更新到本地仓库；</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;第二步：<span style="color: #333333; font-family: Arial; line-height: 26px;">第三步： 将服务器端的更新pull到本地仓库进行合并，最后将合并好的本地仓库push到服务器端</span></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">&nbsp;</p><img src ="http://www.blogjava.net/paulwong/aggbug/430509.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/paulwong/" target="_blank">paulwong</a> 2016-05-15 17:46 <a href="http://www.blogjava.net/paulwong/archive/2016/05/15/430509.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>