简体   繁体   中英

Best way to find (a) buggy file(s) with git

I wonder if any of you have a good method finding the "bad file/code". Let's say we have a branch from a working master. I change several files (+10). After the change I discover that something broke, and let's for arguments sake state it is not an obvious error. When stashing my changes - it works. Popping the back the changes - broken.

I know I can use git diff, which is excellent, but that means I have to understand all the implications of a specific change (and in a legacy system you didn't build that is more often then not the case). And for 10+ files it tend to get boooring - and we don't want boring, do we?

I was pondering about a way to stash only specific files - is that possible?

Or perhaps to make a copy of the branch and "checkout --" the files one by one?

How would you do?

If you have a way to test if a given revision is good or not, then you can use git-bisect to find the bad commit. See the part "Binary Search" of the Git book .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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