Skip to content

Instantly share code, notes, and snippets.

$ git diff
diff --git a/foo.rb b/foo.rb
index 5a90c2b..c1590ba 100644
--- a/foo.rb
+++ b/foo.rb
@@ -3,9 +3,17 @@ class Foo
puts 'bar'
end
+ def baz
$ git add -p
diff --git a/foo.rb b/foo.rb
index 5a90c2b..c1590ba 100644
--- a/foo.rb
+++ b/foo.rb
@@ -3,9 +3,17 @@ class Foo
puts 'bar'
end
+ def baz
Stage this hunk [y,n,q,a,d,/,s,e,?]? ?
y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk nor any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk nor any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
Stage this hunk [y,n,q,a,d,/,s,e,?]? s
Split into 2 hunks.
@@ -3,8 +3,12 @@
puts 'bar'
end
+ def baz
+ puts 'baz'
+ end
+
Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? y
@@ -6,6 +10,10 @@
private
def qux
puts 'qux'
end
+
+ def quux
+ puts 'quux'
@@ -6,6 +10,10 @@
private
def qux
puts 'qux'
end
+
+ def quux
+ puts 'quux'
+ end
$ git diff
diff --git a/foo.rb b/foo.rb
index c1590ba..91801c6 100644
--- a/foo.rb
+++ b/foo.rb
@@ -1,18 +1,16 @@
class Foo
def bar
- puts 'bar'
+ puts 'BAR'
$ git add -p
diff --git a/foo.rb b/foo.rb
index c1590ba..91801c6 100644
--- a/foo.rb
+++ b/foo.rb
@@ -1,18 +1,16 @@
class Foo
def bar
- puts 'bar'
+ puts 'BAR'
# Manual hunk edit mode -- see bottom for a quick guide
@@ -1,18 +1,16 @@
class Foo
def bar
- puts 'bar'
+ puts 'BAR'
+ $logger.log 'Foo#bar'
end
·
def baz
# Manual hunk edit mode -- see bottom for a quick guide
@@ -1,18 +1,16 @@
class Foo
def bar
- puts 'bar'
+ puts 'BAR'
end
·
def baz
- puts 'baz'