A couple of weeks ago I started looking using Matplotlib to calculate the information theoretic entropy for a project I'm working on. I wasn't getting the result I expected, so I had a look at the source code. Thinking something was wrong, I checked my sanity by posting a stackoverflow question and firing off a question to matplotlib-users@lists.sourceforge.net. Having confirmed the documentation on the function was wrong, @efiring suggested "submit a pull request that fixes the documentation".
I am totally new to Open Source development, so it took a bit of time to figure out how to get this done. Submitting the pull request was pretty straightforward. Or it would have been, except I messed it up the first time by not actually getting the fix right, so I had to make another commit to fix the fix. The final hurdle was how to carry out this task, which @efiring (very reasonably) requested of me:
"For the sake of reducing clutter in the history, I would prefer to see the 2 commits squashed down to one and force-pushed."
For my own sanity in case I ever need to do this again, here are my notes on how to Squash Commits and Force Push. First of all I found this. So I did this:
git rebase -i HEAD~2
Then I followed the instructions in the stackoverflow question and changed the second line pick
to s
. Now I struggled with VIM! I eventually figured out you need to press i
to edit a line, then escape, then :w
to save (write) the file, then :q
to quit. This helped.
Next I checked the log with:
git log --pretty=oneline
But apparently I had messed up the commit message with my inexpert use of VIM. Stackoverflow to the rescue again. To fix the erroneous message:
git commit --amend -m "Fix documentation of entropy function"
Then I used the Git UI to sync the repository. But annoyingly this recreated the original two commits! I realised there must be some extra meaning to the phrase 'force-pushed'. So back through the 'squashing' process again using rebase. Finally with the help (yet again) of Stackoverflow, I finally did this:
git push origin +master
That was fun! My first foray into Open Source development. Somewhat faltering, but I got there in the end. The GitHub pull request is here.