0
0
Gitdevops~20 mins

git bisect run for automated bisect - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Git Bisect Automation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Output of git bisect run with a simple test script
You run git bisect run ./test_script.sh where test_script.sh exits 0 if the commit is good and 1 if bad. What will be the final output after bisect completes?
Git
git bisect start
# Assume bad commit is HEAD, good commit is v1.0
# test_script.sh returns 0 on good, 1 on bad
# git bisect run ./test_script.sh
A
Bisecting: 3 revisions left to test after this (roughly 2 steps)
[commit_hash] Commit message

Bisecting incomplete, manual intervention needed
B
Bisecting: 3 revisions left to test after this (roughly 2 steps)
[commit_hash] Commit message

No bad commits found
C
Bisecting: 3 revisions left to test after this (roughly 2 steps)
[commit_hash] Commit message

<commit_hash> is the first bad commit
D
error: ./test_script.sh: command not found
Bisecting stopped
Attempts:
2 left
💡 Hint
Think about what git bisect run does when the test script returns 0 or 1.
🧠 Conceptual
intermediate
1:30remaining
Purpose of git bisect run
What is the main purpose of using git bisect run in a git repository?
ATo create a new branch and switch to it
BTo automatically find the first bad commit by running a test script on each commit
CTo merge two branches automatically without conflicts
DTo reset the repository to the last commit
Attempts:
2 left
💡 Hint
Think about how automation helps in finding bugs in commits.
Troubleshoot
advanced
2:00remaining
Why does git bisect run stop unexpectedly?
You run git bisect run ./test_script.sh but bisect stops after a few commits with the message: error: test_script.sh: command not found. What is the most likely cause?
AThe test script is not executable or not in the PATH during bisect
BThe repository has no bad commits
CThe git bisect command is deprecated
DThe test script returns exit code 0
Attempts:
2 left
💡 Hint
Check the permissions and location of the test script.
🔀 Workflow
advanced
2:30remaining
Correct sequence to use git bisect run
What is the correct sequence of commands to use git bisect run to find a bad commit?
A1,3,2,4
B3,1,2,4
C2,1,3,4
D1,2,3,4
Attempts:
2 left
💡 Hint
Start bisect, mark bad, mark good, then run the test script.
Best Practice
expert
3:00remaining
Best practice for writing a test script for git bisect run
Which of the following is the best practice when writing a test script to use with git bisect run?
AExit with 0 if the commit is good, 1 if bad, and 125 if the test cannot be run
BAlways exit with 0 regardless of test result
CPrint the commit hash and exit with 2 on bad commits
DUse interactive prompts to ask the user if the commit is good or bad
Attempts:
2 left
💡 Hint
Check git bisect run exit code conventions.