惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
C
Cybersecurity and Infrastructure Security Agency CISA
G
Google Developers Blog
The Cloudflare Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
The GitHub Blog
The GitHub Blog
TaoSecurity Blog
TaoSecurity Blog
V
Visual Studio Blog
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
博客园 - Franky
S
Security @ Cisco Blogs
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
T
Troy Hunt's Blog
B
Blog RSS Feed
A
About on SuperTechFans
IT之家
IT之家
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
J
Java Code Geeks
S
Securelist
T
Threatpost
SecWiki News
SecWiki News
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Y
Y Combinator Blog
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Forbes - Security
Forbes - Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
Docker
N
News and Events Feed by Topic
Schneier on Security
Schneier on Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
月光博客
月光博客
C
CXSECURITY Database RSS Feed - CXSecurity.com
罗磊的独立博客
H
Hacker News: Front Page
N
News and Events Feed by Topic
N
Netflix TechBlog - Medium
AWS News Blog
AWS News Blog
P
Privacy International News Feed
Scott Helme
Scott Helme
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
V
Vulnerabilities – Threatpost
The Register - Security
The Register - Security

博客园 - yinsua

OpenBCI调试记录 Qt QML/Quick程序部署 一种CAN接口电路的隔离方案 【转载】0-5V转4-20mA电路以及Howland电流源分析与仿真 【转载】外置USB供电与内置锂电池供电自动切换电路 模块的电气隔离的例子(音频采集电路) 【转载】EMC 共模电感选型 RS485的电路防护设计 ubuntu 20.04 安装VMware Tools Linux常用操作 MOS管随笔 RTX V4随笔 【转载】Keil MDK的sct分散加载文件详解 lua语言 简单类测试 git报错error: could not lock config file RT-Thread速览——内核 ARM MDK开发中的\$Super\$\$main与\$Sub\$\$main - yinsua - 博客园 cpolar(内网穿透工具)安装 VSCode + EIDE开发记录
Git 加入gitignore文件后应用
yinsua · 2024-10-10 · via 博客园 - yinsua

现有项目中加入gitignore文件后需要清除缓存才能使gitignore文件生效,从而屏蔽掉指定文件/夹,执行如下命令即可:
git rm --cached -r <dist-folder>
然后执行git add .添加当前文件,提交代码:git commit -m "XXXXXXX"


参考:https://www.cnblogs.com/yalong/p/14986408.html
由于特殊原因,把.gitignore文件下 /dist 注释了,也就是把dist 文件添加到git仓库里了,
现在又不想添加到git仓库里了,但是把/dist 注释放开还不行,就是.gitignore失效了,查阅资料才知道
.gitignore 只对未跟踪的文件起作用!

已跟踪的文件是指那些被纳入了版本控制的文件,在上一次提交中有它们的记录。那么未跟踪文件就是指那些从没提交过的文件。

因为上次已经把/dist 整个提交上去了,所以这时候.gitignore已经不行了

要想实现git 忽略dist文件夹,需要下面几个步骤

1.取消文件跟踪

git rm 或者 git rm --cached
git rm : 同时从工作区和索引中删除文件。即本地的文件也被删除了。
git rm --cached:从索引中删除文件,但是本地文件还存在, 只是不希望这个文件被版本控制。
这里我使用第二个,具体用法就是 git rm --cached -r dist
-r 的意思是递归处理,如果不加 -r的话,会报错
如果取消某个文件的跟踪,可以不用 -r 直接 git rm --cached dist/index.less

2.把 gitignore 提交上去

git add .
git commit -m '修改gitignore'
git push

以后本地dist目录下文件再变的话,也不会被跟踪到了,其他小伙伴,只需git pull 一下就可以