noknow.dev
Sign inSign up
Course overview
Git — Complete Course
0 / 24 lessons0%

Git Basics

  • git init — Starting a Repository
  • git add + git commit — Your First Commit
  • git status + git log — Reading the State
  • git diff — Seeing What Changed
  • .gitignore — Ignoring Files

Branching

  • git branch + git switch — Working with Branches
  • git merge — Combining Branches
  • Resolving Merge Conflicts
  • Cleaning Up Branches

Remote Repositories

  • git remote — Connecting to a Remote
  • git push — Uploading Your Commits
  • git fetch + git pull — Getting Remote Changes
  • git clone — Copying a Repository

Undoing Changes

  • git restore — Discarding Uncommitted Changes
  • git reset — Moving HEAD Back
  • git revert — Safely Undoing a Commit
  • git stash — Temporarily Saving Work

Rewriting History

  • git commit --amend — Fixing the Last Commit
  • git rebase — Cleaner History
  • git cherry-pick — Applying Specific Commits

Advanced Tools and Workflows

  • git tag — Marking Releases
  • Mastering git log
  • git bisect — Finding Bugs with Binary Search
  • Professional Git Workflows

git bisect — Finding Bugs with Binary Search

0m 00s

Tracking Down When a Bug Was Introduced

git bisect uses binary search to find the commit that introduced a bug — even in a repo with thousands of commits:

git bisect start
git bisect bad                  # current commit is broken
git bisect good v1.0.0          # last known good state

# Git checks out a commit halfway between good and bad
# Test it — is it broken?
git bisect bad                  # yes, still broken → bug is before this
git bisect good                 # no, it's fine → bug is after this

# Repeat until Git finds the exact commit
# Then end the bisect session
git bisect reset                # go back to original branch

Automated bisect

# If you have a script that returns 0 (good) or 1 (bad):
git bisect run bash test.sh

Your Task

Use git bisect run to find the bad commit automatically. The test script checks if value.txt contains good. The result should be stored in BAD_COMMIT.

Back
bashCtrl+Enter to run
Output

Click "Run" to execute your code.