Amit Dhamu

Software Engineer

Step Through Commits On A Branch In Git

Open a terminal window and do the following.

for commit in $(git rev-list <branch> --reverse)
    git checkout $commit

Each time you press Enter, it will step through to the next commit on the branch.

Have a second terminal window open to check stuff in the repository.


Alternatively, you can use git-bisect to pinpoint the commit where a problem might have started occurring. Assuming master is currently "bad":

git checkout master
➜ git pull
➜ git bisect start
➜ git bisect bad
➜ git bisect good a8dbfe1 # last hash where the code was "good"

At this point, git will checkout revisions based on what you've told it and you can check each one. If it's good, simply put git bisect good and it will move to the next one and so on until you've found the culprit.

 git / steps / debug / terminal / bisect

Case Insensitive Multi Dimensional Array SortForce Delete iCloud Account on macOS

Show Comments

Made with by Amit Dhamu.
© MMXX. All rights reserved.