Skip to content

Make target dir self-ignoring #15061

Open
@senekor

Description

Problem

Every Rust project using git requires a .gitignore file with the content /target. This contributes to a cluttered project directory.

Proposed Solution

Whenever cargo creates the target directory, it should also create a file target/.gitignore with the content * to ensure the directory ignores itself. That way, a top-level .gitignore file that's checked into version control can be avoided completely in many cases.

Notes

This is part of #11548, which also proposes that cargo doesn't generate the top-level .gitignore file anymore. As mentioned in this comment, that should only be done much later (if at all) for backwards-compatibility reasons.

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitA-layoutArea: target output directory layout, naming, and organizationC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions