相当于”mv”、”git rm”、”git add”三个命令
git rm
git-rm - Remove files from the working tree and from the index
git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>…
git rm <filename> # 从工作区和仓库索引移除文件,已提交的快照不会受到影响,只是不再继续追踪
git rm --cached <filename> # 从仓库索引中移除文件,但是工作区不受影响。常常用于add操作之后,发现多添加了文件。
git mv
git-mv - Move or rename a file, a directory, or a symlink
git mv <options>… <args>…
git mv # 改名
mv命令相当于:
$ mv source dest
$ git rm source
$ git add dest
参考文献:
https://git-scm.com/docs/git-rm