I want to remove all git related files in project except .gitignore file. The commands I found about git remove will remove everything, but most of the time I still need gitignore
How would you do that?
rm -rf .git
这将删除除gitignore以外的所有git文件
You can set a environment in order to ignore special file patterns for the *
For example:
GLOBIGNORE='.git*'
git rm *
so it won't remove any files that starts with .git
However, if you want to ignore every dot file you can have a look at dotglob
# set dotglob
shopt -s dotglob
git rm *
# unset dotglob
shopt -u dotglob
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.