Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git 只追踪指定目录下的变更 #186

Closed
Dream4ever opened this issue Apr 5, 2022 · 0 comments
Closed

Git 只追踪指定目录下的变更 #186

Dream4ever opened this issue Apr 5, 2022 · 0 comments
Labels

Comments

@Dream4ever
Copy link
Owner

需求描述

多人可以共同操作的服务器上,某个域名对应的文件夹下,不同的人都会往里面上传网站代码及相关文件。

为了自己开发方便,干脆把文件夹下的所有子文件夹和文件都默认忽略掉,只追踪自己用来放网站的子文件夹和文件,相当于开启白名单模式。

解决过程

用的 .gitignore all folders except 这个关键词,一搜就搜到想要的结果了:How do I tell Git to ignore everything except a subdirectory?

下面的代码就是默认忽略根目录下的所有文件和文件夹,只追踪 bin 文件夹下的变更:

/*
/*/
!/bin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant