Tag Archives: Git

如何撤销Git Pull操作

前几天使用Git Pull代码的时候发现对项目文件做的自动合并出了问题,无奈之下只能寻求撤销Pull操作的方法,幸运地在StackOverFlow上发现了一篇文章。


git reset --hard


git pull will do two things: it does a git fetch and then a git merge where it merges branches that have been setup to be merged in your config.

So what you want to do is to undo the merge (undoing the fetch doesn’t make a lot of sense and shouldn’t be necessary).

To do that you can try using git reset --hard to reset to a previous state. Use the git-reflogcommand to find the SHA-1 of the previous state and then reset to it.


Posted by on 十一月 5, 2012 in solutions


Tags: , ,

解决Xcode中使用Git时出现This file does not exist at the requested revision.

最近升级了Xcode4.3,使用过程中切换到Version Editor进行对比时,一部分文件出现了”This file does not exist at the requested revision.”,但是该文件确实是在Git的管理下。

之前我尝试过删除项目的Derived Data(方法请参考我的另一篇文章Xcode4中代码补全(Code Completion)失效的解决方案),有效过一次,后来就再也不行了。

由于Git本身没有问题,所以问题应该是出在Xcode上。我尝试在Xcode->Window->Organizer->Repositories中删除掉相关的Repository,随后“完全退出”Xcode,再重新打开工程,Version Editor就可以正常工作了。

一定记得完全退出,Xcode->Quit(⌘Q),否则连接Repository的时候会出现 The repository “(null)” could not be reached.


Posted by on 四月 5, 2012 in Xcode


Tags: , ,