Wednesday, August 5, 2015

Git rebase --i = nice :)

I'm trying to contribute to the NuGet SkyScanner package - which is hosted on GitHub. I've forked the library and made my changes - and now I wanted to create a pull-request.

Great - works fine, however the pull request had all the small commits in that I made for myself, but it will not be very nice to have all of them in the original repository. Therefore, I wanted to get them all into one single commit and create a pull request for that.

Turns out to be a piece of cake:


Turns out, you need to squash your commits and force push it to the GitHub repository. It's going to require some command line wizardry ( even on Windows ), so prepare for some cmd and even some Vim, but it is definately doable.

Here's a how to: https://robots.thoughtbot.com/git-interactive-rebase-squash-amend-rewriting-history


But the result will be a very nice and clean git history:


I think this idea stems from Gary Bernhardt ( https://www.destroyallsoftware.com/ )  - someone told me about how he does this all the time and told me.

No comments:

Post a Comment