Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create .gitignore even if inside existing repository #6357

Open
vbrandl opened this issue Nov 28, 2018 · 4 comments
Open

Create .gitignore even if inside existing repository #6357

vbrandl opened this issue Nov 28, 2018 · 4 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-new S-needs-team-input Status: Needs input from team on whether/how to proceed.

Comments

@vbrandl
Copy link

vbrandl commented Nov 28, 2018

Describe the problem you are trying to solve

When creating a new cargo project using the cargo new subcommand inside an existing git repository, cargo does not create a .gitignore file. That way, also the target directory will be tracked by git.

Describe the solution you'd like

Even if a new project is created inside another git repository, the .gitignore file should still be created

@alexcrichton alexcrichton added Command-new C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` labels Nov 28, 2018
@dsolisherrera
Copy link

Implementing the described solution would be really nice, I just ran into the same issue.

@Iniesta8
Copy link

Iniesta8 commented Dec 6, 2019

@alexcrichton: What do you think about adding target instead of /target to .gitignore or ignore files of other VCS?

If you do so, subprojects would also be covered by the existing ignore file.

Another approach would be to propagate existing vcs ignore files (see my pull request).

Iniesta8 added a commit to Iniesta8/cargo that referenced this issue Dec 6, 2019
With this post, when creating a new project within an existing project, any existing VCS is reused by creating a matching ignore file in the new subfolder. (see issue rust-lang#6357)
@Flying-Toast
Copy link

Instead of defaulting to not creating .gitignore in these situations, cargo should give the option to opt out of creating it by passing cargo new an option such as --workspace-member or --in-workspace. IMO, this would be more correct since there are no circumstances where build artifacts should actually be tracked in VCS.

@agorgl
Copy link

agorgl commented Jan 27, 2021

Any progress on this?

@epage epage added the S-needs-team-input Status: Needs input from team on whether/how to proceed. label Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-new S-needs-team-input Status: Needs input from team on whether/how to proceed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants