Add chunk(s) of modified file to a commit interactively

Posted on

Use git add -p *filename* or git add –patch *filename* to interactively pick which parts of modified file should be added to a commit.

The pick dialog looks like this:

@@ -24,7 +32,12 @@ module CoreMIDI

   functions.each do |func|
-    attach_function *func
+    begin
+      attach_function *func
+    rescue Exception => e
+      $stderr.puts "Couldn't attach function #{func.first}"
+      raise
+    end

   def midi_read_proc()
Stage this hunk [y/n/a/d/K/j/J/e/?]?

more info:

Leave a Reply

Your email address will not be published.