aboutsummaryrefslogtreecommitdiff
path: root/_tils/2020-11-12-git-bisect-automation.md
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-11-12 16:52:35 -0300
committerEuAndreh <eu@euandre.org>2020-11-12 16:56:15 -0300
commitac114ade0e4230bb626e42ac897770ea85afd712 (patch)
treed78e4a27890dcd1944cfafb331cdeae987096613 /_tils/2020-11-12-git-bisect-automation.md
parentAdd useful bash variables TIL (diff)
downloadeuandre.org-ac114ade0e4230bb626e42ac897770ea85afd712.tar.gz
euandre.org-ac114ade0e4230bb626e42ac897770ea85afd712.tar.xz
Add git bisect TIL, modifying the Bash TIL date to sort on the list
Diffstat (limited to '_tils/2020-11-12-git-bisect-automation.md')
-rw-r--r--_tils/2020-11-12-git-bisect-automation.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/_tils/2020-11-12-git-bisect-automation.md b/_tils/2020-11-12-git-bisect-automation.md
new file mode 100644
index 0000000..ff3ed34
--- /dev/null
+++ b/_tils/2020-11-12-git-bisect-automation.md
@@ -0,0 +1,33 @@
+---
+
+title: Git bisect automation
+
+date: 2020-11-12 2
+
+layout: post
+
+lang: en
+
+ref: git-bisect-automation
+
+---
+
+It is good to have an standardized way to run builds and tests on the repository
+of a project, so that you can find when a bug was introduced by using
+`git bisect run`.
+
+I've already been in the situation when a bug was introduced and I didn't know
+how it even was occurring, and running Git bisect over hundreds of commits to
+pinpoint the failing commit was very empowering:
+
+```
+$ GOOD_COMMIT_SHA=e1fd0a817d192c5a5df72dd7422e36558fa78e46
+$ git bisect start HEAD $GOOD_COMMIT_SHA
+$ git bisect run sn -c './build.sh && ./run-failing-case.sh'
+```
+
+Git will than do a binary search between the commits, and run the commands you
+provide it with to find the failing commit.
+
+Instead of being afraid of doing a bisect, you should instead leverage it, and
+make Git help you dig through the history of the repository to find the bad code.