将文件移出版本控制 (Revision Control)

本文详细介绍了Git中用于删除文件的两个重要命令:git rm --cached 和 git rm。解释了如何从版本控制中移除文件而不删除本地文件,以及如何完全移除文件。还提供了-n 或 --dry-run 选项的使用说明。

两条重要的 Git 命令:
git rm -r -n --cached /path/to/the/directory

git rm -r --cached /path/to/the/directory


The git rm command removes files from the index, or from the working tree and the index. git rm will not remove a file from just your working directory. (There is no option to remove a file only from just your working tree and yet keep it in the index; use /bin/rm if you want to do that.) The files being removed have to be identical to the tip of the branch, and no updates to their contents can be staged in the index, though that default behavior can be overridden with the -f option. When --cached is given, the staged content has to match either the tip of the branch or the file on disk, allowing the file to be removed from just the index.

-n, --dry-run
Don’t actually remove any file(s). Instead, just show if they exist
in the index and would otherwise be removed by the command.

(excerpted from the man page of git-rm.)

转载于:https://www.cnblogs.com/Patt/p/6193546.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值