Last Updated: February 25, 2016
·
903
· bartekfi

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

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
   end

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

more info: http://nuclearsquid.com/writings/git-add/

1 Response
Add your response

Nice, but for such things I prefer gui.

over 1 year ago ·