Git: Interactive Revert

I recently made a commit in a project that, mistakenly, included changes to db/schema.rb. My local schema was out of date and this could cause trouble for the others in my team. Luckily we use a successful git branching model so my changes were still up for review by the team. The change I made was part of larger commit. But all I wanted was to revert serveral chunks from db/schema.

Move your latest commits to a separate branch

The situation is pretty straightforward. You have been making commits for that new feature in your master branch. Naughty you! Let’s assume you want to have this: A - B - (C) - D - E - F C was the last commit you pulled from origin and D, E and F are commits you just made but should have been in their own branch. This is what you wanted:

Showing Ruby, Rails and git info in your app

Some people’ve asked me how I show rendering information on There are a few things going on here, let me explain them one by one. Rails version The current Rails version is probably the easiest you see here. Rails exposes its version information like this: Rails.version Ruby version Ruby also exposes version information, albeit using constants: RUBY_VERSION => "1.9.3" You may know that ruby also has different patch levels for each release.