Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

.gitignore does not take effect

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

In git, if you want to ignore a file and keep it from being submitted to the version library, you can use the method of modifying the .gitignore file in the root directory (if not, you need to create the file yourself). Each line of this file holds a matching rule such as:

# this is a comment-will be ignored by Git * .a # ignore all files ending with .a! lib.a # except lib.a / TODO # ignore only TODO files in the project root directory, not including subdir/TODObuild/ # ignore all files in the build/ directory doc/*.txt# ignores doc/notes.txt but does not include doc/server/arch.txt

The rules do not explain too much, but sometimes in the project development process, suddenly want to add certain directories or files to the ignore rules, according to the above method definition found that did not take effect, because .gitignore can only ignore those files that were not originally track, if some files have been included in version management, modify .gitignore is invalid. The solution is to delete the local cache (change it to a non-track state), and then submit:

Git rm-r-- cached .git add .git commit-m'update .gitignore'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report