b02c09b..32be950 100644 --- a/lib/person.rb +++ b/lib/person.rb @@ -1,4 +1,15 @@ +# This is just an example comment. + module GitExample class Person + attr_reader :name + + def initialize(name) + @name = name + end + + def to_s + "<Person name: #{@name}>" + end end end Stage this hunk [y,n,q,a,d,/,e,?]? s
is just an example comment. + module GitExample class Person Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? y @@ -1,4 +3,13 @@ module GitExample class Person + attr_reader :name + + def initialize(name) + @name = name + end + + def to_s + "<Person name: #{@name}>" + end end end Stage this hunk [y,n,q,a,d,/,K,g,e,?]? n
(use "git reset HEAD <file>..." to unstage) modified: lib/person.rb Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: lib/person.rb
88a0494 Flesh out Person class. # Rebase b1ce32e..88a0494 onto b1ce32e (2 command(s)) # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # d, drop = remove commit # # These lines can be re-ordered; they are executed from top to bottom. # # If you remove a line here THAT COMMIT WILL BE LOST. # # However, if you remove everything, the rebase will be aborted. # # Note that empty commits are commented out
88a0494 Flesh out Person class. # Rebase b1ce32e..88a0494 onto b1ce32e (2 command(s)) # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # d, drop = remove commit # # These lines can be re-ordered; they are executed from top to bottom. # # If you remove a line here THAT COMMIT WILL BE LOST. # # However, if you remove everything, the rebase will be aborted. # # Note that empty commits are commented out
first commit's message is: Add comment. # This is the 2nd commit message: Flesh out Person class. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Date: Mon Nov 16 19:11:43 2015 -0800 # # interactive rebase in progress; onto b1ce32e # Last commands done (2 commands done): # pick 246eb8c Add comment. # squash 88a0494 Flesh out Person class. # No commands remaining. # You are currently editing a commit while rebasing branch 'master' on # 'b1ce32e'. # # Changes to be committed: # modified: lib/person.rb #
in lib/person.rb Recorded preimage for 'lib/person.rb' Automatic merge failed; fix conflicts and then commit the result. $ vim lib/person.rb $ cat lib/person.rb # This is just an example comment. module GitExample class Person attr_reader :first_name, :age def initialize(first_name, age) @first_name = first_name @age = age end def to_s "<Person first_name: #{@first_name}, age: #{@age}>" end end end
name -> first_name. $ git merge master Auto-merging lib/person.rb CONFLICT (content): Merge conflict in lib/person.rb Resolved 'lib/person.rb' using previous resolution. Automatic merge failed; fix conflicts and then commit the result. $ cat lib/person.rb # This is just an example comment. module GitExample class Person attr_reader :first_name, :age def initialize(first_name, age) @first_name = first_name @age = age end def to_s "<Person first_name: #{@first_name}, age: #{@age}>" end end end
text, if necessary. Wrap it to about 72 characters or so. In some contexts, the first line is treated as the subject of an email and the rest of the text as the body. The blank line separating the summary from the body is critical (unless you omit the body entirely); tools like rebase can get confused if you run the two together. Write your commit message in the imperative: "Fix bug" and not "Fixed bug" or "Fixes bug." This convention matches up with commit messages generated by commands like git merge and git revert. Further paragraphs come after blank lines. - Bullet points are okay, too - Typically a hyphen or asterisk is used for the bullet, followed by a single space, with blank lines in between, but conventions vary here - Use a hanging indent