简体   繁体   English

将文件置于版本控制下-如何取消跟踪并忽略它们

[英]put files under version control - how to untrack them and ignore

I've added files under version control. 我已经在版本控制下添加了文件。 Now I need to remove them from version control and ignore in my project. 现在,我需要从版本控制中将其删除,并在我的项目中将其忽略。 Is it enough to just put those files inside .gitignore or I have to delete them first? 仅将这些文件放在.gitignore就足够了,还是我必须先删除它们? What's the correct procedure? 正确的程序是什么?

If you want to remove the file from git while leaving it in your working directory, you need to git rm --cached the file, then commit. 如果要从git中删除文件,同时将其保留在工作目录中,则需要git rm --cached该文件,然后提交。 If you just add the file to .gitignore , the current version of the file will remain in git. 如果仅将文件添加到.gitignore ,则文件的当前版本将保留在git中。

Yes, .gitignore is it enough (if you just want do not track this files) But if you want delete it from your project and from git - delete files 是的, .gitignore就足够了(如果您只想不跟踪此文件),但是如果要从项目和git中删除它-删除文件

Thats all ;) 就这样 ;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在不删除文件的情况下取消跟踪或忽略文件? - How Do I untrack or ignore files without having them deleted in Git? git-将文件放回版本控制下 - git - put files back under version control Git:如何取消跟踪文件而不将它们暂存以进行删除 - Git: how to untrack files without staging them for deletion 如何有效地组织脚本以便将它们置于版本控制之下? - How to effectively organize scripts so they can be put under version control? 如何告诉git忽略某些文件中的更改,而不是将它们放在.gitignore中? - How to tell git to ignore changes in certain files, but not to put them in .gitignore? 您如何将 AppleScript 脚本置于版本控制之下? - How would you put an AppleScript script under version control? 如何将数据库放在 git 下(版本控制)? - How can I put a database under git (version control)? Scala:什么是.metadata文件,我可以在版本控制中忽略它们吗? - Scala: what are .metadata files and can I ignore them in my version control? 如何将 org 文件置于 git 控制之下,以便 git 忽略计算结果部分的更改? - How do I put an org file under git control such that git will ignore changes in calculated RESULTS sections? 为什么要在版本控制下将文件放在.idea文件夹中? - Why should I put files inside .idea folder under version control?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM