简体   繁体   English

愚蠢的GIT GUI问题

[英]Stupid GIT GUI questions

I feel really stupid right now. 我现在真的很蠢。 I have used a number of version control apps but not git that much. 我已经使用了许多版本控制应用程序,但使用的不是git。 I have read lots of posts, but am more confused than ever as many of the (apparently correct) answers use the command prompt and assumptions that I understand GIT much better than I do. 我已经阅读了很多文章,但是比以往任何时候都更困惑,因为许多(显然是正确的)答案使用命令提示符和假设使我比我更了解GIT。

I am working in windows on a project with multiple people checking in code. 我正在Windows中的一个项目上,有多个人签入代码。 We use Git Gui, but I also have Git Bash installed. 我们使用Git Gui,但我也安装了Git Bash。 Up till now, all I have needed to do was commit, push, pull, and merge and life was good. 到现在为止,我所要做的只是承诺,推动,拉动和合并,生活是美好的。

I want to be able to roll back my code commit session by commit session until I can get back to a version were a module that was tested and complete was working. 我希望能够逐个提交会话回滚我的代码提交会话,直到我可以返回到经过测试且完全正常工作的模块的版本为止。 I have no idea when the code was subsequently broken. 我不知道什么时候代码被破坏了。

I do NOT want to modify the main repository, but my local version. 我不想修改主存储库,但要修改我的本地版本。 Once I find the change, I then want to copy the files, restore back to the current version and then apply the diffs from the copied files to the current version and check that in. 找到更改后,我想复制文件,还原到当前版本,然后将复制的文件中的差异应用到当前版本并检入。

I have tried a number of options, but none seem to allow me to do this. 我尝试了许多选择,但似乎没有一个可以让我这样做。 And I don't want to screw up the main repository either. 而且我也不想搞乱主存储库。

I have to believe this is rather simple, just not sure how to do it. 我必须相信这很简单,只是不确定如何去做。 And yes, I could spend a few days learning the intricacies of Git, but right now, I have to get the code working, not break the main repository, and not lose a few days to figuring out git./git gui/etc. 是的,我可以花几天时间学习Git的复杂性,但是现在,我必须使代码正常工作,不要破坏主存储库,也不要浪费几天来弄清楚git./git gui / etc。 (which is really the right way to do it-but people need this code working (again) now. (这确实是正确的方法,但是人们现在(再次)需要此代码。

Thanks! 谢谢!

Crashmstr's comment is the best way to go: http://git-scm.com/docs/git-bisect Crashmstr的评论是最好的选择: http ://git-scm.com/docs/git-bisect

Basically you start bisecting with 基本上,您开始使用

$ git bisect start

Then declare your "bad version" 然后声明您的“错误版本”

$ git bisect bad                 # Current version is bad

And then declare your last known "good version" 然后声明您的最后一个已知的“好版本”

$ git bisect good v2.6.13-rc2    # v2.6.13-rc2 was the last version
                                 # tested that was good

Then you can test each version through bisection until you find the breaking commit. 然后,您可以通过二等分测试每个版本,直到找到中断提交为止。

If you aren't familiar with bisection, basically it's cutting a space into halves until you get the value you want, eg 如果您对二等分不熟悉,那么基本上就是将空间切成两半,直到获得所需的值,例如

[               bad commit in here                       ]
[[        good            ][          bad               ]]
[[        good            ][[   bad      ][    good     ]]

Until you get the actual commit you want. 直到获得所需的实际提交。

A simpler way is to do 一个更简单的方法是

git log

And then checkout each commit one at a time until you find the broken one. 然后一次签出每个提交,直到找到损坏的提交为止。

Eg 例如

$ git log
commit 63cd158599d77ac73abcefd087a2f7bdfdb171cb
Author: Jordan 
Date:   Fri May 1 02:12:46 2015 -0700

    Start look at query builder

commit d0ca01f7c7c2e7a2153fbe3c980f79022f096aad
Author: Jordan
Date:   Thu Apr 30 23:48:38 2015 -0700

    TODO: add cloudsearch filtering for inactive

Then you can checkout an old commit without changing anything with 然后您可以签出旧提交,而无需更改任何内容

git checkout 63cd15

Until you find the broken one. 直到找到损坏的那个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM