Sampson 更新了自己的本地存储库并进入src目录下找到编译后的二进制。查看提交信息后,他意识到,编译后的二进制是由Byron加入的。 .
[sampson@CentOS src]$ pwd
/home/sampson/project/src
[sampson@CentOS src]$ ls
Makefile string_operations string_operations.c
[sampson@CentOS src]$ file string_operations
string_operations: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses
shared libs), for GNU/Linux 2.6.18, not stripped
[sampson@CentOS src]$ git log
commit 29af9d45947dc044e33d69b9141d8d2dad37cc62
Author: Byron <xiaobosun@gridinfo.com.cn>
Date: Wed Sep 11 10:16:25 2015 +0530
Added compiled binary
VCS用于存储源代码,而不是只对可执行的二进制文件。因此,Sampson 决定从资源库中删除此文件。对于进一步的操作,他使用git 的 rm命令。
[sampson@CentOS src]$ ls
Makefile string_operations string_operations.c
[sampson@CentOS src]$ git rm string_operations
rm 'src/string_operations'
[sampson@CentOS src]$ git commit -a -m "Removed executable binary"
[master 5776472] Removed executable binary
1 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100755 src/string_operations
提交后,他推送了他的修改到版本库。
[sampson@CentOS src]$ git push origin master
上面的命令会产生以下结果。
Counting objects: 5, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 310 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To gituser@git.server.com:project.git
29af9d4..5776472 master −> master