DEV Community

Takuya Kikuchi
Takuya Kikuchi

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}


Having a nice commit message helps spot the respective commits 😉

Discussion (2)

bonnev profile image

Check also

git bisect

it automatically and efficiently checks out commits using binary search to find the bug:

takuyakikuchi profile image
Takuya Kikuchi Author

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