Git Walk: Comparing UI Changes
Have you ever noticed that a page looked slightly off or broken but couldn’t figure out which commit introduced the change?
It’s happened to me a few times recently and each time, I slowly walked through the git history until I saw the change go away. This is obviously tedious, so I created this git command to make it a little easier.
git config --global alias.walk '!f() { \
commit=$(git rev-list --max-count=1 --skip=$1 HEAD); \
echo "Checking out commit: $commit"; \
git checkout $commit; \
}; f'Running this will create a git alias that lets you walk back through the history by some number of steps. For example, git walk 1 will allow you to go back one commit. You can run this, let the page refresh, check, and then re-run until you find the breaking commit. Enjoy!