Bisect: Fehlerhafte Commits aufspüren
Verwenden Sie git bisect, um eine binäre Suche in der Historie durchzuführen und den exakten Commit zu finden, der einen Fehler eingeführt hat – auch über Hunderte von Commits hinweg.
Bisect: Fehlerhafte Commits aufspüren ist eine kostenlose Git Advanced: Monorepo, Submodules & Workflows-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Git Advanced: Monorepo, Submodules & Workflows-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Git Advanced: Monorepo, Submodules & Workflows-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
The Needle in the Haystack
A bug hides somewhere in your last 200 commits. git bisect runs a binary search through history, halving the suspect range with each test.
How Binary Search Helps
Checking 200 commits linearly means 200 tests. Binary search needs only about log2(200) ≈ 8 — bisect narrows the culprit dramatically faster.
Starting a Bisect
Kick off a session with git bisect start. From there Git walks you through marking commits as good or bad.
git bisect startMarking Good and Bad
Tell Git where the bug exists (bad) and an older commit where it didn't (good). That bounds the search range.
git bisect bad HEAD
git bisect good v1.2.0Testing Each Checkout
Git checks out the midpoint commit. You test it and report good or bad, and Git picks the next midpoint accordingly.
git bisect good
# or
git bisect badReaching the Culprit
After a few rounds, Git names the first bad commit — its hash, author, and message — the exact change that introduced the bug.
Ending the Session
Always finish with git bisect reset. It returns you to your starting branch and clears the bisect state.
git bisect resetAutomating with a Script
If you can test the bug programmatically, git bisect run ./test.sh automates the whole search — exit 0 means good, non-zero means bad.
git bisect run ./test.shThe Skip Escape Hatch
Hit a commit you can't test (it won't build)? git bisect skip tells Git to try a nearby commit instead.
git bisect skipReviewing the Log
git bisect log saves or replays the decisions you made — useful for documenting how you found a bug or resuming a session later.
git bisect logBest Practices
For reliable bisects: have a clear, reproducible test, keep commits small and atomic, and automate with git bisect run whenever you can.
Quick Check
Test your bisect knowledge.
Recap
Recap: git bisect start, mark good and bad, test each midpoint to halve the range, automate with run, skip the untestable, and reset when done.
Häufig gestellte Fragen
Ist die Lektion „Bisect: Fehlerhafte Commits aufspüren“ kostenlos?
Ja — der vollständige Text von „Bisect: Fehlerhafte Commits aufspüren“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Git Advanced: Monorepo, Submodules & Workflows-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Git Advanced: Monorepo, Submodules & Workflows-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Bisect: Fehlerhafte Commits aufspüren“?
Verwenden Sie git bisect, um eine binäre Suche in der Historie durchzuführen und den exakten Commit zu finden, der einen Fehler eingeführt hat – auch über Hunderte von Commits hinweg. Du übst Git Advanced: Monorepo, Submodules & Workflows mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Git Advanced: Monorepo, Submodules & Workflows zu starten?
Keine Vorkenntnisse erforderlich. Git Advanced: Monorepo, Submodules & Workflows auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.
Wie lange dauert die Lektion „Bisect: Fehlerhafte Commits aufspüren“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Git Advanced: Monorepo, Submodules & Workflows-Lektion Code schreiben und ausführen?
Ja. Jede Git Advanced: Monorepo, Submodules & Workflows-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Interaktives Rebase und Ändern von Commits
- Änderungen stashen und cherry-picken
- Reflog zur Wiederherstellung
- Bisect: Fehlerhafte Commits aufspüren