当我们在提交代码的时候:
stage是把整个文件的修改放到暂存区中.stage hunk是把文件中某一部分代码块的修改放到暂存区中.
hunk的意思就是有修改的代码块
So, 慎重起见, 我们在提交代码的时候, 以hunk为单位, 逐一添加.
可见
Sublime Merge十分清晰明了且美观的把diff的结果展示给了我们.
./git/apply.c
/*
* This represents one "hunk" from a patch, starting with
* "@@ -oldpos,oldlines +newpos,newlines @@" marker. The
* patch text is pointed at by patch, and its byte length
* is stored in size. leading and trailing are the number
* of context lines.
*/
struct fragment {
unsigned long leading, trailing;
unsigned long oldpos, oldlines;
unsigned long newpos, newlines;
/*
* 'patch' is usually borrowed from buf in apply_patch(),
* but some codepaths store an allocated buffer.
*/
const char *patch;
unsigned free_patch:1,
rejected:1;
int size;
int linenr;
struct fragment *next;
};

