Preparando parte de um arquivo no GIT

Se desejar comprometer parte das mudanças nas quais está trabalhando, você pode usar git add -i [file]:

> $ git add -i lib/server.js                                                                                                                      
staged unstaged path

1: unchanged +34/-11 lib/server.js
*** Commands ***
1: status 2: update 3: revert 4: add untracked
5: patch 6: diff 7: quit 8: help
What now> p
staged unstaged path

1: unchanged +34/-11 lib/server.js
Patch update>> 1
staged unstaged path

* 1: unchanged +34/-11 lib/server.js
Patch update>>
diff
--git a/lib/server.js b/lib/server.js
index
70c6f84..b45a02c 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -258,7 +258,6 @@ server.register([
reply
({ error: 'No Data Returned' });
return;
}
-
let datums = [];
if (payload.data) {
datums
= payload.data.map((datum) => {
Stage this hunk [y,n,q,a,d,/,K,j,J,g,e,?]? n
@@ -303,7 +302,8 @@ server.register([
});
+ cb(null, uri);
},
onResponse
: (on_response_error, res, request, reply) => {
/* istanbul ignore next */
Stage this hunk [y,n,q,a,d,/,K,j,J,g,e,?]? y
@@ -378,7 +401,7 @@ server.register([
}

- Wreck.read(res, { json: true }, (wreck_read_error, payload) => {
+ Wreck.read(res, { json: 'force' }, (wreck_read_error, payload) => {
if (wreck_read_error) {
server
.log('error', wreck_read_error.message);
reply
(wreck_read_error);
Stage this hunk [y,n,q,a,d,/,K,g,e,?]? n

*** Commands ***
1: status 2: update 3: revert 4: add untracked
5: patch 6: diff 7: quit 8: help
What now> q
Bye.