I am trying to understand a project, it helps to look at its evolution by using gitk. What I do is checkout the first commit, understand code, run tests, go to next commit and repeat. My current workflow is to checkout the commit through its hash
git checkout 79cd6
But what I would like is another branch where I can perform my own changes, and allows me to merge commits from the master branch, but without the need to find the commit hash. Idealized workflow:
git checkout -b <newbranch> <first commit id of master>
git <command to move head of current branch to next commit of master>
Save this as ~/bin/git-next
or somewhere else in your path:
#!/bin/bash
git co $(git rev-list --children --all | awk "/^$(git rev-parse @\{0})/ { print \$2; }")
This will check out the first child of the current revision.
It will be very slow on a big repo but it will do the job.
You can modify this to handle your branching as needed.
I know this is a bit of an old question, but I wanted to do the same thing and found an answer so I figured I'd share.
for commit in $(git rev-list master --reverse)
do
git checkout $commit
read
done
do this in one window. It will start with your initial commit, and advance once each time you hit enter. Then do your testing etc. in a different shell.
It'll work perfectly with a linear history, but I'm not quite sure how it will handle merges and such. I'm sure it'll be reasonable, but your mileage might vary a bit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With