DEV Community

TK
TK

Posted on

Debug: finding at which commit a 🐞 is created

When you found a bug and want to identify which commit you produced the bug, you can check out commit and check πŸ‘

Check commit ids

$ git log --graph --decorate --pretty=oneline --abbrev-commit

Creating an alias if you like πŸ˜‰
Git - Git Aliases

Image 2021-09-29 at 7.27.01 PM

Checkout commit and check

$ git checkout {commit id}

Go back to the latest commit

git checkout {branch name}

Note

Having a nice commit message helps spot the respective commits πŸ˜‰

Top comments (2)

Collapse
 
piggov profile image
Bonny Piggov

Check also

git bisect

it automatically and efficiently checks out commits using binary search to find the bug: riptutorial.com/git/example/2670/b....

Collapse
 
takuyakikuchi profile image
TK

@bonnev Thanks a lot for sharing git bisect! This is TIL for me ✨