Config
- see config
git config -l
- modify username
git config --global user.name "newName"
- modify email
git config --global user.mail "new@mail.com"
Git bisect
Is a tool to find the exact commit where a bug was introduced.
Usage
I have a file with the following content and an obvious bug
Row row row your car at the river
This is the git history
- master -
added word river
changed word boat for cat
added word the
added word at
added word boat
added word your
added third row
added second row
added word row
Initial commit
We need to select a good and a bad commit. We’ll select the last one as bad because the bug is there, and as good the first one.
git bisect good 6f47e638a6bc5f4210218d77f1c43e34cc16470c
git bisect bad 8a2d118528471d48d87942b8097093dd04476b25
Then it’s going to navigate the commit history, changing the actual commit, and we have to check the file and indicate if it’s still good or it already contains the bug. We do so with
git bisect good
git bisect bad
At the end of all, it tell us the exact commit where the bug was introduced
cff142cdac62f6845d69ea4694c4c5e6606f2294 is the first bad commit
commit cff142cdac62f6845d69ea4694c4c5e6606f2294
Author: Mario Codes <xxx>
Date: Mon Jul 8 16:06:33 2019 +0200
changed word boat for car
And we have to exit it with
git bisect reset
Reference(s)
https://git-scm.com/docs/git-bisect
https://www.metaltoad.com/blog/beginners-guide-git-bisect-process-elimination