Skip to content

Git Repo Creation Should Be Opt-In: --skip-git #4854

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

Closed
majew7 opened this issue Feb 21, 2017 · 10 comments
Closed

Git Repo Creation Should Be Opt-In: --skip-git #4854

majew7 opened this issue Feb 21, 2017 · 10 comments

Comments

@majew7
Copy link

majew7 commented Feb 21, 2017

OSX El Capitan v10.11.6

CLI: v1.0.0-beta.32.3

Repro steps

  1. I ran ng new my-app inside a directory inside my Mercurial repo.
  2. I observed many files in .git folder.

I had no expectation by running ng new my-app that a Git Repo would be created too. This command did something I didn't expect. I was highly confused; no documentation told me this would occur.

Suggestion A: This feature may be helpful for some, but not all. Make the feature OPT-IN, not OPT-OUT.

Suggestion B: Let the new command ask, via a workflow if a Git Repo is desired.

Thanks!

@beeman
Copy link
Contributor

beeman commented Feb 21, 2017

I was highly confused; no documentation told me this would occur.

@majew7 the command ng new informs the user that a new git repo is initialised:

Successfully initialized git.

@dave11mj
Copy link
Contributor

@beeman I think @majew7 point is that ng new assumes you want a git repo, when in a lot of cases the angular2 app may be part of a bigger repository. Given ng has no dependencies on git or git specific features, I kinda agree it would be nice if the command asked for confirmation before deciding to initialize a git repository.

@filipesilva
Copy link
Contributor

We try to stay away from prompts in general. I understand this was surprising behaviour, but it's quite telling that it took so long to be brought up. I think in most cases it's ok, and even when you don't want it it's trivial to 'correct' it.

@pageza
Copy link

pageza commented Aug 12, 2017

I agree, it is totally screwing up my pushes since I push one main folder, and since all the subdirectories are initialized it doesn't want to add them no matter what I do, delete the .git, the .gitignore, add . -f, etc. The only thing I think would solve this is if the CLI didn't assume I wanted a new git init everytime I start a new project. Don't even need to prompt or make in opt-in/out, simply give us the option to git init when we decide to. So far I haven't found anything that rectifies this.

@dave11mj
Copy link
Contributor

@pageza does --skip-git not work for you ? it's a reliable way to not generate the .git directory whenever you are initializing a new project. You can read more about it on the ng new documentation

@pageza
Copy link

pageza commented Aug 16, 2017

I finally got that sorted for all my new projects. The point remains, it should be opt-in, instead of assuming I want all of my projects to be git initialized, or maybe at least a prompt asking if I want to init it.

@patrickh1
Copy link

100% agree that a git repository should not be initialized by default. Use 'git init' if you want to create a new git repository for the new angular application. Version control is a completely separate activity to application creation (and git is not the only version control system out there...). Even if git is used for version control the user may not want to initialize a new repository but rather add the new application to an existing repository.

@ADTC
Copy link

ADTC commented Nov 26, 2017

I agree with this as well. Although I am a Git user myself and I like that a Git repository could be used to version control my Angular project, I am quite surprised that a Git repository is initialized by default by a command that is not expected to do so. I totally agree that this should be an opt-in behavior, not an opt-out behavior.

The flag should really be --init-git, not --skip-git and the default behavior should be to not initialize a Git repo. The --init-git flag could be a nice shortcut to automatically initialize a Git repo and make an initial commit of the project (unless --skip-commit is given), but it should never be an imposed behavior of ng new.

Angular projects are in no way dependent on having a Git repository at their root and can function without one, so why create an unnecessary Git repo in every project? Some may not even bother about the repo at all, while others might find it frustrating that they have to clean up the mess by deleting the .git folder just because they forgot the --skip-git flag.

Sidenote issue:

One thing I noticed is that, giving the --skip-git option also skips creating a .gitignore file. It should not. I filed this in #8638.

@akrueger
Copy link

This seems to list "angular-cli" as the contributor for commits on all of my Github projects. Is there a way to change that?

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants