Nest all content into snippets
This commit is contained in:
35
snippets/git/s/manual-find-commit-with-bug.md
Normal file
35
snippets/git/s/manual-find-commit-with-bug.md
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
title: Manually find the commit that introduced a bug
|
||||
type: snippet
|
||||
language: git
|
||||
tags: [commit,branch]
|
||||
author: chalarangelo
|
||||
cover: blue-computer
|
||||
dateModified: 2021-04-13T21:10:59+03:00
|
||||
---
|
||||
|
||||
Uses a binary search algorithm to manually find which commit in history introduced a bug.
|
||||
|
||||
- Use `git bisect start` to start the process.
|
||||
- Use `git bisect good <commit>` to mark a `<commit>` as "good", indicating it is known to be bug-free.
|
||||
- Use `git bisect bad <commit>` to mark a different `<commit>` as "bad" indicating it has the bug.
|
||||
- Use `git bisect (bad | good)` marking each subsequent commit as "good" or "bad" depending if it has the bug or not.
|
||||
- Use `git bisect reset` to reset to the original branch. You can optionally specify a `<commit>` to reset to.
|
||||
|
||||
```shell
|
||||
git bisect start
|
||||
git bisect good <commit>
|
||||
git bisect bad <commit>
|
||||
git bisect (bad | good)
|
||||
git bisect reset [<commit>]
|
||||
```
|
||||
|
||||
```shell
|
||||
git bisect start
|
||||
git bisect good 3050fc0de
|
||||
git bisect bad c191f90c7
|
||||
git bisect good # Current commit is good
|
||||
git bisect bad # Current commit is buggy
|
||||
# ... some time later the bad commit will be printed
|
||||
git bisect reset # Goes to the original branch
|
||||
```
|
||||
Reference in New Issue
Block a user