<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>https://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>https://jackxiang.com/post//</link>
<title><![CDATA[you need to resolve your current index first 的解决办法，以及出现Changed but not updated:(use git add file... to update what will be committed)(use git checkout -- file... to discard changes in working directory)]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[版本控制]]></category>
<pubDate>Thu, 22 Jun 2017 16:15:22 +0000</pubDate> 
<guid>https://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	问题：在<br/>$git status<br/># On branch master<br/><br/>$git checkout master<br/>README.txt: needs merge<br/>error: you need to resolve your current index first<br/><br/>git reset --merge <br/><br/>git pull #好了，但是出现：<br/># Changed but not updated:&nbsp;&nbsp;( Changes bu not updated → 文件被修改，但并没有添加到暂存区。如果 commit 时没有带 -a 选项，这个状态下的文件不会被提交)<br/>#&nbsp;&nbsp; (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)<br/>#&nbsp;&nbsp; (use &quot;git checkout -- &lt;file&gt;...&quot; to discard changes in working directory)<br/><br/>现在有两个操作可供选择，要么把暂存区的所有内容添加到当前分支上；要么清除暂存区回退成与分支内容一致，但工作区没有清除，若想把工作区也清除，就得在使用git checkout -- file(这里的--后面有一个空格键)命令了。详细解说如下：<br/><br/>方法一，<br/>按提示的来：&quot;git checkout -- &lt;file&gt;...，发现还是不行，其它兄弟试了下是可以的，法一居然不行，其它兄弟试可以，最后用了法二：<br/>git checkout -- ./WxPayApi.php #某个文件<br/>git checkout -- *&nbsp;&nbsp;#这命令是还原当前分支下的所有修改到stage上并未commit的文件，-- 后面是文件名的意思。<br/><br/>以上方法没有办法搞定，奇怪了，最后还是用最后，这样解决了：<br/>git commit -am&quot;解决一下Master的：Changed but not updated&quot; ， 用：-am，Git的小乌龟难道看不到吗？奇怪了，默认就是-am呀，所有人都用乌龟就好了 ,绝对不会出现问题,哈哈，命令行捣蛋了？？？<br/>解决办法继续参看：http://blog.csdn.net/qq_38801354/article/details/72793909<br/><br/><br/><br/>方法二、<br/>用git commit -am&quot;个人自媒体代码的Dev分支也解决一下Dev分支的问题，给全提交到仓库。&quot;，再提交Git服务器仓库，得以解决。<br/>先检出Master：<br/>$git checkout master<br/>M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; api.jackxiang.com/components/WxPay/WxPayApi.php<br/>M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; api.jackxiang.com/components/WxPay/WxPayConfig.php<br/>M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; api.jackxiang.com/components/WxPay/WxPayDataBase.php<br/>M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; api.jackxiang.com/components/WxPay/WxPayException.ph<br/>核对还是有问题：<br/>$git status<br/># On branch dev<br/># Changed but not updated:<br/>#&nbsp;&nbsp; (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)<br/>#&nbsp;&nbsp; (use &quot;git checkout -- &lt;file&gt;...&quot; to discard changes in working directory)<br/>#<br/>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; modified:&nbsp;&nbsp; api.jackxiang.com/components/WxPay/WxPayApi.php<br/><br/>git commit -am&quot;只有这样解决了上面这个Changed but not updated问题&quot;<br/>$git commit -am&quot;解决一下Master的：Changed but not updated&quot; <br/><br/>把所有的都给提交了（Dev没有改动，无所谓）：<br/>git push --all<br/><br/>同理那个Dev分支也是一样的道理：<br/>$git checkout master<br/>$git status<br/>$git commit -am&quot;个人自媒体代码的Dev分支也解决一下Dev分支的问题，给全提交到仓库。&quot;<br/><br/><br/><br/><br/>================================================================================<br/>从一个分支A切换到另一个分支B后，对切换后的B分支进行pull操作，因为pull操作实际上包含了fetch+merge操作，在执行 merge操作时，由于很长时间没有对B分支执行过pull/merge操作，本地的B分支库与remote中的B分支库中的差异很大（且这些差异是其他 同事开发的文件），merge时产生冲突，使得B分支的状态为merging，其实是指merge失败，还停留在merge状态，也不能执行pull操 作。这时没有解决冲突，而是从B分支上执行checkout/switchto操作，试图再切换其他分支时，报：<br/>[plain] view plaincopy在CODE上查看代码片派生到我的代码片<br/>…….java : needs merge&nbsp;&nbsp;<br/>…….java : needs merge&nbsp;&nbsp;<br/>…….java : needs merge&nbsp;&nbsp;<br/>error : you need to resolve your current index first&nbsp;&nbsp;<br/>的错，google了半天，终于在stackoverflow上找到了答案，大题意思是：merge失败，有conflicts没解决，可以：<br/>1、解决conflicts后再次执行merge；<br/>2、回退到merge前<br/>恩，既然merge冲突是其他同事的文件，我不需要去resolve conflicts，那就退回merge前吧，单纯的改我的文件再push吧，执行以下代码：<br/>[plain] view plaincopy在CODE上查看代码片派生到我的代码片<br/>git reset --merge&nbsp;&nbsp;<br/>搞定！<br/><br/>顺便贴下stackoverflow上的链接：<br/>http://stackoverflow.com/questions/6006737/git-merge-errors<br/>本文参考来自链接：https://www.lbbniu.com/3059.html
]]>
</description>
</item><item>
<link>https://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] you need to resolve your current index first 的解决办法，以及出现Changed but not updated:(use git add file... to update what will be committed)(use git checkout -- file... to discard changes in working directory)]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>