📅  最后修改于: 2020-11-01 03:56:10             🧑  作者: Mango
到目前为止,Tom和Jerry都使用手动命令来编译他们的项目。现在,Jerry决定为其项目创建Makefile,并为文件“字符串.c”指定一个适当的名称。
[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 commit自动检测修改后的文件。
[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
现在,其他开发人员可以通过更新其本地存储库来查看这些修改。