<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -10,7 +10,11 @@ Example
 
 class MyMigration &lt; ActiveRecord::Migration
   
-  git_fu
+	# Will rollback to the commit that this file was checked in on
+  use_git
+ 
+	# Will rollback to a certain commit that you define
+	# use_git :revision =&gt; &quot;2024589c214b41c8b29bcd6444c2d49807760a5a&quot;
 
   def self.up
     puts &quot;This is a test migration&quot;</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -23,7 +23,8 @@ module GittyMigration
   
   module ClassMethods
         
-    def git_fu
+    def use_git(options={})
+      @@options = options
       class_eval do
         class &lt;&lt; self
           alias_method_chain :migrate, :git
@@ -34,7 +35,8 @@ module GittyMigration
     def migrate_with_git(direction, version)
       settings = MigrationSettings.new(
         :version =&gt; version,
-        :klass =&gt; self.to_s.underscore
+        :klass =&gt; self.to_s.underscore,
+        :revision =&gt; @@options[:revision]
       )
       before_migrate(settings) 
       migrate_without_git(direction)
@@ -42,18 +44,21 @@ module GittyMigration
     end
 
     def before_migrate(settings)
-      g = settings.git
-      # Find the commit that matches your sha1
-      commit = g.gcommit(&quot;#{settings.revision}&quot;)
-      # If we can't find the commit, continue without using gitty migrations
-      if commit.nil?
-        say &quot;Could not find git sha1 that matches '#{settings.revision}'. The migration will continue without git_fu&quot;
-      else
+      begin
+        g = settings.git
+        # Find the commit that matches your sha1
+        commit = g.gcommit(&quot;#{settings.revision}&quot;)
+        # Will throw an error if the commit isn't known. Bit of a hack :(
+        commit.gtree
+        
         say &quot;Migrating with git&quot;
         say &quot;SHA1: #{settings.revision}&quot;
         say &quot;AUTHOR: #{settings.revision_author}&quot;
         say &quot;DATE: #{settings.revision_date}&quot;
         say &quot;MESSAGE: #{settings.revision_message}&quot;
+      rescue
+        say &quot;WARNING =&gt; Could not find git sha1 that matches '#{settings.revision}'. The migration will continue without gitty migrations&quot;
+      else
         # Stash any changes that you may have in your current branch
         g.branch(settings.original_branch).stashes.save(settings.revision) if settings.stash?
         # Checkout a new branch to use for your migration</diff>
      <filename>lib/gitty_migration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -24,6 +24,8 @@ class MigrationSettings
       @revision = commit.sha
     end
     @revision
+  rescue
+    @revision = nil
   end
   
   def stash?</diff>
      <filename>lib/migration_settings.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0fdf502ece8922723be1fd54df4bbe0b9f5de11c</id>
    </parent>
  </parents>
  <author>
    <name>Eric Goodwin</name>
    <email>eric@ericgoodwin.com</email>
  </author>
  <url>http://github.com/ericgoodwin/gitty-migrations/commit/7c6e495f29fd3c49bb5059451fcaf0a59969de8a</url>
  <id>7c6e495f29fd3c49bb5059451fcaf0a59969de8a</id>
  <committed-date>2008-03-31T11:04:51-07:00</committed-date>
  <authored-date>2008-03-31T11:04:51-07:00</authored-date>
  <message>Added rescue blocks incase getting the proper revision fails
Added revision options back in
Renamed the invocation method again
Rewrote readme to relect changes</message>
  <tree>88be3c8d0e1a0b1ebf6c874c9501ddea1f286816</tree>
  <committer>
    <name>Eric Goodwin</name>
    <email>eric@ericgoodwin.com</email>
  </committer>
</commit>
