MAC系统git commit 时忽略.ds_store文件(已实测)

博客介绍了在Mac系统下,针对git仓库的操作。包括从仓库中移除现有文件,将某行内容添加到仓库顶级目录的.gitignore文件(若文件不存在则创建),还提醒直接复制命令段以免出错。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.Remove existing files from the repository:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

2.Add the line

.DS_Store

to the file .gitignore, which can be found at the top level of your repository (or created if it isn’t there already). You can do this easily with this command in the top directory

echo .DS_Store >> .gitignore

3.Then

git add .gitignore
git commit -m '.DS_Store banished!'

提示:直接复制命令段,以免出错,尤其是第一条

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值