Git版本库文件删除和重命名

Git版本库文件删除

首先先暂存删除的变更

[root@git git_test]# git rm git_test_file
rm 'git_test_file'

把删除的变更提交到版本库

[root@git git_test]# git commit -m "remove file"
[master e754b82] remove file
1 files changed, 0 insertions(+), 2 deletions(-)
delete mode 100644 git_test_file

Git版本库文件重命名

[root@git git_test]# git mv git_test_file git_test_file.raw
[root@git git_test]# ls -al
total 16
drwxr-xr-x. 3 root root 4096 Dec 18 20:51 .
drwx--x--x. 30 root root 4096 Dec 18 20:15 ..
drwxr-xr-x. 8 root root 4096 Dec 18 20:51 .git
-rw-r--r--. 1 root root 5 Dec 18 20:49 git_test_file.raw

你可能感兴趣的:(Git版本库文件删除和重命名)