18.5.2 开发者user1工作在发布分支

开发者user1修改帮助信息中的文字错误,具体操作过程如下。

(1)编辑文件src/main.c,将"-help"字符串修改为"—help"。


$cd/path/to/user1/workspace/hello-world/

$vi src/main.c


(2)开发者user1的改动可以从下面的差异比较中看到。


$git diff

diff—git a/src/main.c b/src/main.c

index 6ee936f..e76f05e 100644

—-a/src/main.c

+++b/src/main.c

@@-11,7+11,7@@int usage(int code)

"say hello to the world.\n\n"

"hello<username>\n"

"say hi to the user.\n\n"

-"hello-h,-help\n"

+"hello-h,—help\n"

"this help screen.\n\n",_VERSION);

return code;

}


(3)执行提交。


$git add-u

$git commit-m "Fix typo:-help to—help."

[hello-1.x b56bb51]Fix typo:-help to—help.

1 files changed,1 insertions(+),1 deletions(-)


(4)推送到远程共享版本库。


$git push

Counting objects:7,done.

Delta compression using up to 2 threads.

Compressing objects:100%(4/4),done.

Writing objects:100%(4/4),349 bytes,done.

Total 4(delta 3),reused 0(delta 0)

Unpacking objects:100%(4/4),done.

To file:///path/to/repos/hello-world.git

ebcf6d6..b56bb51 hello-1.x->hello-1.x