簡體   English   中英

IntelliJ IDEA如何甚至不使用.gitignore文件自動從Git存儲庫中檢測並忽略目標目錄?

[英]How IntelliJ IDEA automatically detects and ignore target directory from a Git repo without even using .gitignore file?

我是第一次使用IntelliJ IDEA。 我將已經存在的項目添加到Git中,當我看到未版本化和被忽略的文件時,我看到target/目錄已經在“ 忽略字段”列表中。 由於我什至沒有.gitignore文件,因此如何從Git中排除target/目錄?

更新 :是的,這是一個Maven項目

  1. Preferences | Editor | File Types, Ignore files and folders Preferences | Editor | File Types, Ignore files and folders* .hprof; *。pyc; *。pyo; *。rbc; *。yarb; *〜; .DS_Store; .git; .hg; .svn; CVS; __ pycache __; _ svn; vssver .scc; vssver2.scc;

  2. .git/info/exclude

    #git ls-files --others --exclude-from = .git / info / exclude
    #以'#'開頭的行是注釋。
    #對於大多數使用C語言編寫的項目,以下內容將是不錯的選擇
    #排除模式(如果要使用它們,請取消注釋):
    #*。[oa]
    \\#*〜

  3. git config --global core.excludesfile指向“ some-path / some-path / .gitignore_global”,里面的內容是:
    *〜
    .DS_Store

本主題所述

Preferences | Editor | File Types, Ignore files and folders Preferences | Editor | File Types, Ignore files and folders允許全局忽略文件/文件夾。

還要檢查您的git config --global core.excludesfile設置,該設置可以更新。
並且,如前所述,您的項目.git/info/exclude文件。

請注意,例如,默認的JetBrains .gitignore不會忽略嵌套文件夾中的.idea/workspace.xml文件。 (請參閱問題IDEA-90785

設置

workspace.xml用於存儲用戶特定的(非共享的)運行配置。

因此,我在挖掘一些IDEA博客,然后發現了這一點 IDEA創建了一個workspace.xml文件,其中包含被忽略的路徑,這是其中的一項
<ignored path="$PROJECT_DIR$/my-website-REST/target/" />我相信這是IDEA忽略版本控制文件的地方。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM