Linux command to delete all files except .git folder?

后端 未结 6 647
别跟我提以往
别跟我提以往 2020-12-15 03:46

I want to delete all of the current directory\'s content except for the .git/ folder before I copy the new files into the branch.

6条回答
  •  庸人自扰
    2020-12-15 04:26

    for i in `ls | grep -v ".git"` ; do rm -rf $i; done; rm .gitignore;
    

    the additional rm at the end will remove the special .gitignore. Take that off if you do need the file.

提交回复
热议问题