Last active
December 14, 2019 15:56
-
-
Save ttacon/7fe8338e82a3aab028a63f61ff712ce1 to your computer and use it in GitHub Desktop.
git-hunks-example-initial-git-diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git example.js example.js | |
index d5dd17d..1abd66a 100644 | |
--- example.js | |
+++ example.js | |
@@ -13,7 +13,7 @@ function exampleCall({ nameObj } = {}) { | |
lastName: nameObj.lastName | |
}; | |
- if (!nameObj.firstName && !nameObj.lastName) { | |
+ if (!nameObj || (!nameObj.firstName && !nameObj.lastName)) { | |
retObj.anObjectHasNoName = true; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/example.js b/example.js | |
index e6e3f90..1abd66a 100644 | |
--- a/example.js | |
+++ b/example.js | |
@@ -7,9 +7,13 @@ const _ = require("underscore"); | |
*/ | |
function exampleCall({ nameObj } = {}) { | |
- const retObj = { ..._.omit(nameObj, "firstName", "lastName"), firstName: nameObj.firstName, lastName: nameObj.lastName }; | |
+ const retObj = { | |
+ ..._.omit(nameObj, "firstName", "lastName"), | |
+ firstName: nameObj.firstName, | |
+ lastName: nameObj.lastName | |
+ }; | |
- if (!nameObj.firstName && !nameObj.lastName) { | |
+ if (!nameObj || (!nameObj.firstName && !nameObj.lastName)) { | |
retObj.anObjectHasNoName = true; | |
} | |
Stage this hunk [y,n,q,a,d,s,e,?]? s | |
Split into 2 hunks. | |
@@ -7,5 +7,9 @@ | |
*/ | |
function exampleCall({ nameObj } = {}) { | |
- const retObj = { ..._.omit(nameObj, "firstName", "lastName"), firstName: nameObj.firstName, lastName: nameObj.lastName }; | |
+ const retObj = { | |
+ ..._.omit(nameObj, "firstName", "lastName"), | |
+ firstName: nameObj.firstName, | |
+ lastName: nameObj.lastName | |
+ }; | |
Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? y | |
@@ -11,5 +15,5 @@ | |
- if (!nameObj.firstName && !nameObj.lastName) { | |
+ if (!nameObj || (!nameObj.firstName && !nameObj.lastName)) { | |
retObj.anObjectHasNoName = true; | |
} | |
Stage this hunk [y,n,q,a,d,K,g,/,e,?]? n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git example.js example.js | |
index e6e3f90..1abd66a 100644 | |
--- example.js | |
+++ example.js | |
@@ -7,9 +7,13 @@ const _ = require("underscore"); | |
*/ | |
function exampleCall({ nameObj } = {}) { | |
- const retObj = { ..._.omit(nameObj, "firstName", "lastName"), firstName: nameObj.firstName, lastName: nameObj.lastName }; | |
+ const retObj = { | |
+ ..._.omit(nameObj, "firstName", "lastName"), | |
+ firstName: nameObj.firstName, | |
+ lastName: nameObj.lastName | |
+ }; | |
- if (!nameObj.firstName && !nameObj.lastName) { | |
+ if (!nameObj || (!nameObj.firstName && !nameObj.lastName)) { | |
retObj.anObjectHasNoName = true; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On branch trey/fix-deref | |
Changes to be committed: | |
(use "git reset HEAD <file>..." to unstage) | |
modified: example.js | |
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: example.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment