Have you ever found yourself wondering what branch a particular commit came from in git? Or how your master branch ended up containing that commit that really shouldn't be there? That commit probably started its live on a separate branch before making its way to the master branch through a series of pull requests and merges. This merge history can be quite complex and there is no tool that just shows you the relevant merges. The git-story ruby script aims to remedy this.
First you'll need to install the git-story gem, as this will download the other gems required to run this script:
gem install git-story
Next you'll want to download the script file from the /lib folder and make it executable by running:
chmod u+x git-story
You can now run it by calling the script by its full path name. You could also put the script somewhere in your $PATH and run it by typing 'git-story'.
Finding all the ways that a given commit could have made it into a particular branch is as easy as running
git-story --commit <your commit sha here> --branch <your branch name here>
The output will be of the form
Possible path ------------- <commit date> <commit sha> <commit message> <author> START <commit date> <commit sha> <commit message> <author> MERGE <commit date> <commit sha> <commit message> <author> MERGE ... <commit date> <commit sha> <commit message> <author> HEAD