Skip to content

Commit ddb7e48

Browse files
authored
Added 'git bisect' trick to the Winter Term 2024/25 Git tricks section (#196)
* Added Git bisect trick to the Winter Term 2024/25 Git tricks section * Resolved trailing space and added link for demo repository
1 parent 6415777 commit ddb7e48

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

01_version_control/my_favorite_neat_little_git_trick_demo.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
- *Toptal* also provides a [cli tool](https://docs.gitignore.io/install/command-line) which enables quick creation of a `.gitignore` file in the current repository.
2929
- You can also use `wget` or `curl` in combination with [https://www.toptal.com/developers/gitignore/api/](https://www.toptal.com/developers/gitignore/api/) followed by a comma (`,`) separated list to get the `.gitignore` file directly without the cli.
3030
31+
- Use Git Bisect to identify bugs in your code
32+
- This command uses a binary search algorithm to find which commit in your project's history introduced a bug. You use it by first telling it a "bad" commit that is known to contain the bug, and a "good" commit that is known to be before the bug was introduced. Then git bisect picks a commit between those two endpoints and asks you whether the selected commit is "good" or "bad".
33+
- Start bisecting with `git bisect start`, mark the bad commit using `git bisect bad <commit>` and the last known good one with `git bisect good <commit>`. After a bisect session, to clean up the bisection state use `git bisect reset`.
34+
- It continues narrowing down the range until it finds the exact commit that introduced the change/bug.
35+
- For a practical demonstration, refer to the following repository: [Git Bisect Little Trick Demo](https://github.com/Vaish-W/git-bisect-little-trick-demo).
36+
3137
## Tricks from Winter Term 2022/23
3238
3339
- An interactive learning environment: [Learn Git Branching](https://learngitbranching.js.org/)

0 commit comments

Comments
 (0)