Git 常用技巧
# Git 常用技巧
# 根据 .gitignore 文件删除已添加到仓库中的内容
方法 1
git rm --cached `git ls-files -i -c --exclude-from=.gitignore`
1如果含有汉字等非 ASCII 编码,则此方法失效
- 需要使用下列命令禁用 git 引用的八进制表示法打印非 ASCII 文件名
git config --global core.quotepath off
1
how-to-remove-files-that-are-listed-in-the-gitignore-but-still-on-the-repositor (opens new window)
how-to-make-git-properly-display-utf-8-encoded-pathnames-in-the-console-window (opens new window)方法 2
git rm -r --cached . git add . git commit -m "Drop files from .gitignore"
1
2
3how-to-remove-files-that-are-listed-in-the-gitignore-but-still-on-the-repositor (opens new window)
编辑 (opens new window)
上次更新: 2022/01/26, 21:01:00