Skip to content

Commit

Permalink
DS_Store
Browse files Browse the repository at this point in the history
  • Loading branch information
oddfar committed Feb 17, 2023
1 parent 4ba92d3 commit b40e152
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ docs/.vuepress/dist
# 百度链接推送
urls.txt
### mac ###
.DS_Store
**/.DS_Store
.DS_Store?
.DS_Store
.DS_Store
*/.DS_Store
27 changes: 27 additions & 0 deletions docs/05.工具部署/01.Git/06.DS_Store.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: Git - DS_Store
date: 2023-02-17 22:46:45
permalink: /pages/0fc313/
---
[[TOC]]

## .DS_Store 是什么

使用 Mac 的用户可能会注意到,系统经常会自动在每个目录生成一个隐藏的 .DS_Store 文件。.DS_Store(英文全称 Desktop Services Store)是一种由苹果公司的Mac OS X操作系统所创造的隐藏文件,目的在于存贮目录的自定义属性,例如文件们的图标位置或者是背景色的选择。相当于 Windows 下的 desktop.ini。

## 删除 .DS_Store

如果你的项目中还没有自动生成的 .DS_Store 文件,那么直接将 .DS_Store 加入到 .gitignore 文件就可以了。

```
.DS_Store
*/.DS_Store
```

如果你的项目中已经存在 .DS_Store 文件,那就需要先从项目中将其删除,再将它加入到 `.gitignore`。如下:

```sh
#删除项目中的所有.DS_Store。这会跳过不在项目中的 .DS_Store
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
```

0 comments on commit b40e152

Please sign in to comment.