Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 3006|回复: 0
打印 上一主题 下一主题

git 中忽略整个文件夹

[复制链接]

1228

主题

1997

帖子

7586

积分

认证用户组

Rank: 5Rank: 5

积分
7586
跳转到指定楼层
楼主
发表于 2017-2-8 10:41:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
关键:在项目的根目录(跟.git文件夹所在目录同层)建立.gitignore文件,在里面声明即可。
譬如我要忽略当前项下的所有dll文件,及runtime文件夹里所有文件:
#ignore these files
*.dll
runtime/*

如果之前文件已提交过,则需要先清除原文件,针对上文做的清理如下:
$ git rm *.dll
$ git rm -r runtime

另一种方法:修改git的全局设置,把忽略名单用于所有项目:
首先,建立一个.gitignore_global文件;
执行 $ git config --global core.excludesfile .gitignore_global

常用ignore rules:

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-5-8 21:19 , Processed in 0.055819 second(s), 19 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表