diff --git a/drupalorg_project/plugins/release_packager/DrupalorgProjectPackageRelease.class.php b/drupalorg_project/plugins/release_packager/DrupalorgProjectPackageRelease.class.php
index 7cb6859..3410478 100644
--- a/drupalorg_project/plugins/release_packager/DrupalorgProjectPackageRelease.class.php
+++ b/drupalorg_project/plugins/release_packager/DrupalorgProjectPackageRelease.class.php
@@ -60,7 +60,7 @@ class DrupalorgProjectPackageRelease implements ProjectReleasePackagerInterface
     $this->filenames['file_path_zip'] = $file_destination_subdir . '/' . $this->release_file_id . '.zip';
     $this->filenames['full_dest_zip'] = $file_destination_root . '/' . $this->filenames['file_path_zip'];
   }
-  
+
   /**
    * One-time initialization shared across all instances of this class.
    */
@@ -68,9 +68,9 @@ class DrupalorgProjectPackageRelease implements ProjectReleasePackagerInterface
     if (self::$shared_init) {
       return;
     }
-    
+
     putenv("TERM=vt100");  // drush requires a terminal.
-    
+
     self::$shared_init = TRUE;
   }
 
@@ -192,6 +192,40 @@ class DrupalorgProjectPackageRelease implements ProjectReleasePackagerInterface
   protected function fixInfoFileVersion($file, $project_short_name, $version) {
     global $site_name;
 
+    // Dev releases get a really spiffy version number.
+    if (!empty($this->release_node->project_release['rebuild'])) {
+      $git = $this->conf['git'] . ' --git-dir=' . escapeshellcmd($this->project_node->versioncontrol_project['repo']->root);
+      // Try to fill in branch and tag.
+      exec("$git rev-parse --abbrev-ref HEAD 2>&1", $branch);
+      $tag_found = FALSE;
+      if ($branch) {
+        $branch = $branch[0];
+        // Any Drupal-formatted branch.
+        $branch_preg =  '\d+\.x-\d+\.';
+        if (preg_match('/^' . $branch_preg . 'x$/', $branch)) {
+          $this->release_version = $branch . '-dev';
+          // Nail down the core and the major version now that we know
+          // what they are.
+          $branch_preg = preg_quote(substr($branch, 0, -1));
+        }
+        // Now try to find a tag.
+        exec("$git rev-list --topo-order --max-count=1 HEAD 2>&1", $last_tag_hash);
+        if ($last_tag_hash) {
+          exec("$git describe  --tags $last_tag_hash[0] 2>&1", $last_tag);
+          if ($last_tag) {
+            $last_tag = $last_tag[0];
+            // Make sure the tag starts as Drupal formatted (for eg.
+            // 7.x-1.0-alpha1) and if we are on a proper branch (ie. not
+            // master) then it's on that branch.
+            if (preg_match('/^(?<drupalversion>' . $branch_preg . '\d+(?:-[^-]+)?)(?<gitextra>-(?<numberofcommits>\d+-)g[0-9a-f]{7})?$/', $last_tag, $matches)) {
+              $tag_found = TRUE;
+              $this->release_version = isset($matches['gitextra']) ? $matches['drupalversion'] . '+' . $matches['numberofcommits'] . 'dev' : $last_tag;
+            }
+          }
+        }
+      }
+    }
+
     $info = "\n; Information added by $site_name packaging script on " . gmdate('Y-m-d') . "\n";
     $info .= 'version = "' . $this->release_version . "\"\n";
 
