Câu hỏi phỏng vấn Git
Câu hỏi

What is git bisect ? How can you use it to ...

Câu trả lời

Git bisect is a powerful tool for efficiently finding the commit that introduced a regression (a bug that broke previously working functionality) in your codebase. It leverages binary search to quickly pinpoint the culprit commit by repeatedly checking out commits between a known "good" state (where the bug did not exist) and a known "bad" state (where the bug does exist).

Here's how to use git bisect to find the source of a regression:

  1. Start the bisect process by running git bisect start.

  2. Specify the "bad" commit where the regression exists by running git bisect bad [<bad_commit>]. If you don't provide a commit hash, it assumes the currently checked out commit is bad.

  3. Specify the "good" commit where the regression did not exist by running git bisect good <good_commit>. Git will then check out a commit halfway between the good and bad commits.

  4. Test the checked out commit to see if the regression is present. If it is, run git bisect bad. If not, run git bisect good.

  5. Repeat step 4, testing each commit and marking it as good or bad, until git narrows down to the exact comm...

expert

expert

Gợi ý câu hỏi phỏng vấn

senior

When would you use git clone --bare over git clone --mirror ?

junior

What is the difference between git pull and git fetch ?

expert

What are the type of git hooks?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào