Staging part of a file in GIT
If you would like to commit part of the changes you are working on you can use 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.
Written by byronsm
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#