最近使用git 管理项目的时候,编译过程中出现了很多中间文件,今天发现使用 git clean 命令可以很方便进行清除:

# 删除 untracked files
git clean -f # 连 untracked 的目录也一起删掉
git clean -fd # 连 gitignore 的untrack 文件/目录也一起删掉 (慎用,一般这个是用来删掉编译出来的 .o之类的文件用的)
git clean -xfd # 在用上述 git clean 前,墙裂建议加上 -n 参数来先看看会删掉哪些文件,防止重要文件被误删
git clean -nxfd
git clean -nf
git clean -nfd
NAME
git-clean - Remove untracked files from the working tree SYNOPSIS
git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>... DESCRIPTION
Cleans the working tree by recursively removing files that are not under version control, starting from the current directory. Normally, only files unknown to Git are removed, but if the -x option is specified, ignored files are also removed. This can, for example, be useful to remove all build products. If any optional <path>... arguments are given, only those paths are affected.
usage: git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>...

    -q, --quiet           do not print names of files removed
-n, --dry-run dry run
-f, --force force
-i, --interactive interactive cleaning
-d remove whole directories
-e, --exclude <pattern>
add <pattern> to ignore rules
-x remove ignored files, too
-X remove only ignored files

保持更新,转载请注明出处;更多内容请访问 cnblogs.com/xuyaowen

最新文章

  1. node学习笔记(三)
  2. Deep learning:四十(龙星计划2013深度学习课程小总结)
  3. curl命令
  4. javascript undefined 和void0
  5. How to index email and attachments in nsf files?
  6. 转 Difference between WCF and Web API and WCF REST and Web Service
  7. 微信公众平台开发—利用OAuth2.0获取微信用户基本信息
  8. 《Linux命令行大全》系列(二、导航)
  9. Linux下安装Java(JDK8)
  10. 创建安全客户端Socket
  11. 【T09】要认识到TCP是一个可靠的,但不是绝对可靠的协议
  12. spark组件笔记
  13. Android Studio引用自定义的framework.jar包
  14. javascript:apply方法
  15. Java Web项目部署时 “Exploded Archive”模式部署时无效
  16. linux服务器---配置bind
  17. jquery validate 之多tab页同时校验问题
  18. 转:动态table分页(ORCALE)
  19. linux kernel 卡在提示信息Waiting for root device /dev/mmcblk0p1...处
  20. 从零开始一个http服务器(二)-请求request解析

热门文章

  1. 阅读webpack代码笔记:antd-layout的webpack.config.prod.js
  2. redis集群搭建及常用操作
  3. DUBBO: xml文件无法解析
  4. .NET开源类库Nini手册(INI、XML、注册表的配置应用)-中文翻译
  5. ES-映射和分析
  6. Android项目实战之高仿网易云音乐创建项目和配置
  7. QT--动态人流量监测系统
  8. 连接查询 变量、if else、while
  9. vue项目、路由
  10. Linux后台运行和关闭jar项目