如何返回到 .gitignore 中的上一个目录 [英] How to go back to previous directory in .gitignore

查看:83
本文介绍了如何返回到 .gitignore 中的上一个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 PhpStorm 作为我的 IDE,它在名为 .idea 的目录中设置了 .gitignore 文件.有些文件夹和文件我想忽略,但无论如何我都无法转到上一个文件夹.

I use PhpStorm as my IDE and it sets up .gitignore file in a directory called .idea. There are folders and files that I want to ignore but I can't go to previous folder no matter what.

让我们创建一个名为 example.txt 的文件.文件夹树看起来像这样:

Lets have file called example.txt. The folder tree looks like this:

- /Project
  - /.idea
    - .gitignore
    - workspace.xml
  - /src
    - example.txt

如何忽略 example.txt 文件?我试过 ../src/example.txt, src/example.txt, /../src/example.txt

How do I ignore example.txt file? I tried ../src/example.txt, src/example.txt, /../src/example.txt

推荐答案

.gitignore 适用于目录及其子目录.它不适用于同级或父目录.

.gitignore applies to a directory and its subdirectories. it does not apply to a sibling or parent directory.

要忽略 src/example.txt,您可以:

  1. src/目录下创建一个.gitignore文件,包含例如

  1. create a .gitignore file in the src/ directory, containing e.g.

example.txt

  • 在父目录中创建一个.gitignore文件,包含例如

    src/example.txt
    

  • 这篇关于如何返回到 .gitignore 中的上一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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