[jerry@CentOS project]$ pwd /home/jerry/jerry_repo/project
[jerry@CentOS project]$ ls README src [jerry@CentOS project]$ cd src/
[jerry@CentOS src]$ git add Makefile [jerry@CentOS src]$ git mv string.c string_operations.c
[jerry@CentOS src]$ git status -s A Makefile R string.c −> string_operations.c
Git 是显示R在文件之前名称来指示文件已更名。 对于提交操作Jerry 使用 -a标志,这使得git 提交自动检测修改过的文件。[jerry@CentOS src]$ git commit -a -m 'Added Makefile and renamed strings.c to string_operations.c '
[master 94f7b26] Added Makefile and renamed strings.c to string_operations.c 1 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/Makefile rename src/{string.c => string_operations.c} (100%)
提交后,他推送了他的修改到版本库。[jerry@CentOS src]$ git push origin master
上面的命令会产生以下结果。Counting objects: 6, done. Compressing objects: 100% (3/3), done. Writing objects: 100% (4/4), 396 bytes, done. Total 4 (delta 0), reused 0 (delta 0) To gituser@git.server.com:project.git 7d9ea97..94f7b26 master −> master
现在,其他开发人员可以通过更新他们的本地资源库中的这些修改。