<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -69,6 +69,10 @@ To search cheat sheets content with 'text', use the --search/-s switch
 
 $ chit text --search
 
+To move or rename a sheet, use '--mv/-m' switch
+
+$ chit zsh_if zsh/if -m
+
 == INSTALL:
 
 sudo gem install robin-chit -s http://gems.github.com</diff>
      <filename>README.txt</filename>
    </modified>
    <modified>
      <diff>@@ -52,15 +52,22 @@ module Chit
     is_private = (@sheet =~ /^@(.*)/)
     @sheet = is_private ? $1 : @sheet
 
-    working_dir = is_private ? private_path : main_path
-    @git = Git.open(working_dir)
+    @working_dir = is_private ? private_path : main_path
+    @git = Git.open(@working_dir)
 
-    @fullpath = File.join(working_dir, &quot;#{@sheet}.yml&quot;)
+    @fullpath = File.join(@working_dir, &quot;#{@sheet}.yml&quot;)
     
     add(sheet_file) and return if (args.delete('--add')||args.delete('-a'))
     edit(sheet_file) and return if (args.delete('--edit')||args.delete('-e'))
     search_title and return if (args.delete('--find')||args.delete('-f'))
     search_content and return if (args.delete('--search')||args.delete('-s'))
+    
+    if (args.delete('--mv') || args.delete('-m'))
+      target = args.shift
+      mv_to(target) and return if target
+      puts &quot;Target not specified!&quot;
+      return
+    end
     true
   end
   
@@ -68,6 +75,21 @@ module Chit
     puts all_sheets.sort.join(&quot;\n&quot;)
   end
   
+  def mv_to(target)
+    if target =~ /^@(.*)/
+      target = $1
+    end
+    target_path = File.join(@working_dir, &quot;#{target}.yml&quot;)
+    prepare_dir(target_path)
+    @git.lib.mv(sheet_file, target_path)
+    sheet = YAML.load(IO.read(target_path)).to_a.first
+    body = sheet[-1]
+    title = parse_title(target)
+    open(target_path,'w') {|f| f &lt;&lt; {title =&gt; body}.to_yaml}
+    @git.add
+    @git.commit_all(&quot; #{@sheet} moved to #{target}&quot;)
+  end
+  
   def search_content
     @git.grep(@sheet).each {|file, lines|
       title = title_of_file(file.split(':')[1])
@@ -154,10 +176,8 @@ module Chit
   
   def add(file)
     unless File.exist?(file)
-      breaker = file.rindex(File::Separator)+1
-      path = file[0,breaker]
-      title = @sheet.split(File::Separator).join('::')
-      FileUtils.mkdir_p(path)
+      prepare_dir(file)
+      title = parse_title(@sheet)
       yml = {&quot;#{title}&quot; =&gt; ''}.to_yaml
       open(file, 'w') {|f| f &lt;&lt; yml}
     end
@@ -182,6 +202,16 @@ module Chit
   end
   
   private
+  def parse_title(sheet_name)
+    sheet_name.split(File::Separator).join('::')
+  end
+  
+  def prepare_dir(file)
+    breaker = file.rindex(File::Separator)+1
+    path = file[0,breaker]
+    FileUtils.mkdir_p(path)
+  end
+  
   def editor
     ENV['VISUAL'] || ENV['EDITOR'] || &quot;vim&quot;
   end</diff>
      <filename>lib/chit.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>aa31da4f25a4cf33b2d25d20ac00c271535fbd23</id>
    </parent>
  </parents>
  <author>
    <name>Robin Lu</name>
    <email>iamawalrus@gmail.com</email>
  </author>
  <url>http://github.com/robin/chit/commit/7a17e20937012e3555497f3190badf86bcc221a5</url>
  <id>7a17e20937012e3555497f3190badf86bcc221a5</id>
  <committed-date>2008-06-22T02:04:55-07:00</committed-date>
  <authored-date>2008-06-22T02:04:55-07:00</authored-date>
  <message>To move or rename a sheet, use '--mv/-m' switch
$ chit zsh_if zsh/if -m</message>
  <tree>28d806e325b23e0ccac1486f161a0ad8c76db34d</tree>
  <committer>
    <name>Robin Lu</name>
    <email>iamawalrus@gmail.com</email>
  </committer>
</commit>
