【问题标题】:.gitignore is being ignored by git gui.gitignore 被 git gui 忽略
【发布时间】:2020-10-13 17:52:49
【问题描述】:

我正在使用 git gui。试图排除一些文件(*.dll、*.pdb - 例如从我的 Unstaged Changes 列表中)。 我有一个 .gitignore 文件 (UTF-8),与 .git 文件夹位于同一文件夹中。 对于测试用例,我正在尝试删除 *.dll 文件(我过去已经提交了这类文件 - 我只是不希望它们出现在 Unstaged Changes 中,在进行新构建之后)。 这是我的 .gitignore 文件内容:

    # See http://help.github.com/ignore-files/ for more about ignoring files.

    # compiled output
    /dist
    /tmp
    /out-tsc
    # Only exists if Bazel was run
    /bazel-out

    # dependencies
    /node_modules

    # profiling files
    chrome-profiler-events*.json
    speed-measure-plugin*.json

    # IDEs and editors
    /.idea
    .project
    .classpath
    .c9/
    *.launch
    .settings/
    *.sublime-workspace

    # IDE - VSCode
    .vscode/*
    !.vscode/settings.json
    !.vscode/tasks.json
    !.vscode/launch.json
    !.vscode/extensions.json
    .history/*

    # misc
    /.sass-cache
    /connect.lock
    /coverage
    /libpeerconnection.log
    npm-debug.log
    yarn-error.log
    testem.log
    /typings

    # System Files
    .DS_Store
    Thumbs.db


    #server side
    *.dll
    *.pdb
    *.suo
    *.cache
    *.ide-wal
    *.out

我做错了什么?

【问题讨论】:

  • "我正在尝试删除 *.dll 文件(我以前已经提交过这些文件)" 您知道.gitignore 不会以任何方式帮助您忽略您已经拥有的文件承诺?
  • @matt - 是的!我知道 - 我正在尝试在当前提交中删除这些文件
  • 这就是git rm 的用途。
  • 哇,谢谢 - 错字了!

标签: git gitignore git-gui


【解决方案1】:

为了使 .gitignore 与已跟踪的文件一起活动,我错过了重要的一步。我在这个 stackoverflow 问题中找到了解决方案: .gitignore is ignored by Git

通过执行这些命令,我​​解决了问题(在确保我的所有文件都已提交之后): git rm -r --cached 混帐添加。 git commit -m "修复未跟踪的文件"

  • 这使我的文件无法跟踪 - 超出了我的需要 - 现在我需要弄清楚如何让它们再次受到控制

【讨论】:

    猜你喜欢
    • 2012-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多