git忽略本地回购中的隐藏目录 [英] git to ignore a hidden directory in the local repo

查看:142
本文介绍了git忽略本地回购中的隐藏目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过执行 git init



来初始化一个项目目录为git local repo,但是 ls -la 显示有一个隐藏目录.idea,我认为我不需要跟踪我的项目。如果这是正确的,我试图将它添加到我的.gitignore购买只是在该文件的末尾附加一个.idea / *。



git status 仍显示.idea /列出。



阅读SO上的其他帖子并没有多大帮助,因为他们试图停止跟踪已经跟踪的文件,或者远程回购。

我试图重新开始并忽略它。想法/从一开始,在本地回购之前,推动任何东西到远程回购。
Thanks $ / $>

解决方案

您可以使用git rm从.idea文件夹中删除被追踪的文件。我通常为Intellij IDEA的项目做的是这样的:

  git rm -r --cached .idea / 

然后

  git add。 
git commit -m排除.idea被跟踪
git push

从这一刻开始,git将不再追踪这个想法文件夹。

你也可以看看这个问题。


I just initialised a project directory to be a git local repo by doing git init

But ls -la shows that there is a hidden directory ".idea" which I think I don't need to track with my project. If that is correct, I tried to add it to my .gitignore buy just appending a ".idea/*" at the end of that file.

git status still shows the .idea/ listed.

Reading other posts on SO did not help me much since they are trying to stop tracking files which are already being tracked, or on the remote repo.
I am trying to start a fresh and ignore .idea/ from the very beginning and on the local repo before pushing anything to the remote repo. Thanks

解决方案

You can use git rm to remove the file in .idea folder from being tracked. What I usually do for my projects with Intellij IDEA, is like this :

git rm -r --cached .idea/

then

git add .
git commit -m "Excluded .idea from being tracked"
git push 

From this moment on, the git won't track the idea folder any more.

You can also take a look at the answers for this question.

这篇关于git忽略本地回购中的隐藏目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆