From 85cb9559737894e4bb37320d5ab74f20f148096c Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Fri, 9 Oct 2020 09:29:53 -0500 Subject: [PATCH] Add Skip A Bad Commit When Bisecting as a git til --- README.md | 3 ++- git/skip-a-bad-commit-when-bisecting.md | 27 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 git/skip-a-bad-commit-when-bisecting.md diff --git a/README.md b/README.md index 7457b4e..892e739 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud). -_953 TILs and counting..._ +_954 TILs and counting..._ --- @@ -257,6 +257,7 @@ _953 TILs and counting..._ - [Show The Good And The Bad With Git Bisect](git/show-the-good-and-the-bad-with-git-bisect.md) - [Show What Is In A Stash](git/show-what-is-in-a-stash.md) - [Single Key Presses in Interactive Mode](git/single-key-presses-in-interactive-mode.md) +- [Skip A Bad Commit When Bisecting](git/skip-a-bad-commit-when-bisecting.md) - [Staging Changes Within Vim](git/staging-changes-within-vim.md) - [Staging Stashes Interactively](git/staging-stashes-interactively.md) - [Stash Everything](git/stash-everything.md) diff --git a/git/skip-a-bad-commit-when-bisecting.md b/git/skip-a-bad-commit-when-bisecting.md new file mode 100644 index 0000000..f585d40 --- /dev/null +++ b/git/skip-a-bad-commit-when-bisecting.md @@ -0,0 +1,27 @@ +# Skip A Bad Commit When Bisecting + +The `git bisect` command helps you quickly track down the commit where a bug +was introduced. It is quick because it picks the optimal (minimal) commits in a +binary search fashion. + +It is possible that `git bisect` will pick a commit that you aren't able to +evaluate as _good_ or _bad_. If that commit is in a WIP state or for some other +unrelated reason prevents you from evaluating it, then you are kinda stuck. + +To move forward, tell `git bisect` that you want to skip this commit: + +```bash +$ git bisect skip +``` + +It will flag that one as skipped and find you another nearby commit to evaluate +instead. + +If your commit history is in such a state that you have to skip many of the +suggested commits, it is possible that `git bisect` will not be able to help +you identify the problem commit. You may be left with a few commits that you'll +have to manually read through and evaluate. + +This is a good reason to keep your commits atomic and in a functional state. + +[source](https://git-scm.com/docs/git-bisect#_bisect_skip)