Date
Oct. 25th, 2024
 
2024年 9月 23日

Post: Git: .DS_Store

Git: .DS_Store

Published 12:12 Dec 12, 2014.

Created by @ezra. Categorized in #Version Control, and tagged as #Git.

Source format: Markdown

Table of Content

.DS_Store 是个很烦人的家伙, 在使用版本控制工具时, 我们都希望能忽略它的存在, 不过在每一个仓库中都设置一次好像更烦人, 那现在我们想办法一次性解决这个问题吧:

vi ~/.gitignore_global

i 进入编辑模式, 增加新行:

.DS_Store
.DS_Store?

如果你要忽略其它没用的文件, 可以继续添加新的行。

esc 后输入 :wq 保存并推出, 然后进入你的仓库:

vi .git/config

[core] 中增加:

excludesfile = /Users/用户名/.gitignore_global

保存退出, 然后提交这次改动。

现在, 你可以 touch 一个 .DS_Store 文件再用 git status 来试试效果了。

Pinned Message
HOTODOGO
The Founder and CEO of Infeca Technology.
Developer, Designer, Blogger.
Big fan of Apple, Love of colour.
Feel free to contact me.
反曲点科技创始人和首席执行官。
开发、设计与写作皆为所长。
热爱苹果、钟情色彩。
随时恭候 垂询