After going through github issues, I've found a commit that might be responsible for breaking code and I want to confirm this suspicion by doing something like:
git checkout --one-prior f1962b3cc771184a471e1350fa280d80d5fdd09d
Here you go:
git checkout f1962b3cc771184a471e1350fa280d80d5fdd09d^
Notice the ^ at the end. That means one revision behind.
For example this would be 5 revisions behind:
git checkout f1962b3cc771184a471e1350fa280d80d5fdd09d^^^^^
... equivalent to:
git checkout f1962b3cc771184a471e1350fa280d80d5fdd09d~5
Btw, when you do this, you'll be in a detached HEAD state. The output explains this, which is very interesting and worth reading:
You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
Not answering your question for a checkout, but you can also use rebase instead.
Here is a short log of my terminal history without working it over.
Rebase to change first the second last and then the last commit
1240 git rebase -i HEAD~2
→ then an editor pops up, write “edit” in front of the commit you
want to change (in my case the older commit, look up the commit msg
in the git repo to find the right one), leave the other at “pick”
1241 git rev-parse HEAD
→ shows the hash, better use `git log`, then you do not need to
remember the hashes!
1242 git add .
1243 git status
1244 git commit --amend
1245 git rebase --continue
1246 git rev-parse HEAD
1247 git reflog
1248 git rebase -i HEAD~2
→ then an editor pops up, write “edit” in front of the commit you
want to change (in my case the younger commit, look up the commit msg
in the git repo to find the right one), leave the other at “pick”
1249 git rev-parse HEAD
1250 git log
1251 git status
1252 git add .
1253 git commit --amend
1254 git rebase --continue
1255 git log
1256 git push -f
1257 git log
git bisectfor hunting down breaking changes: kernel.org/pub/software/scm/git/docs/git-bisect.htmlgit bisectmagic works