Squashing Multiple Commits In Git

Here’s how I create a patch that squashes multiple commits into one, making it easier for the maintainer to review in a project or if you’re working with SVN repo.

Assumptions:

  • The work is done at “working” branch.
  • You’re merging in your changes to “master”
  • “tmp” branch will be used to create the patch
  • The patch will be placed in your Desktop (remember, I use Mac)

Steps:

  • from “master”,
    git checkout -b tmp
  • fetch the squashed commit.
    git merge --squash working
  • commit the differences.
    git commit -a -m "your commit comment"
  • create the patch.
    git format-patch -o ~/Desktop/ master
  • apply patch and clean up.
    git checkout master
    git am ~/Desktop/{name of the patch}
    git branch -D tmp

At this point, you may also want to remove working branch and create a fresh branch.

Conference Videos

I have a family and a job, therefore, I cannot attend all the conferences, even the ones that I’d pay my own money to go. Ruby community is kind enough to provide these videos for me, and I’d like to thank everyone.

MountainWest RubyConf 2010
Red Dirt RubyConf 2010 – you have to purchase the videos for $99. The video quality is good, but the audio quality is less than what I’d hope for. But hey, can’t complain.
JRubyConf 2009 – Not much there and waiting for the rest to show up.
RailsConf 2010 – only selected keynotes on blip.tv

« Previous Page

Powered by Olark