OSX El Capitan v10.11.6
CLI: v1.0.0-beta.32.3
ng new my-app inside a directory inside my Mercurial repo.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!
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.
@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.
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.
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.
@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
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.
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.
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.
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.
This seems to list "angular-cli" as the contributor for commits on all of my Github projects. Is there a way to change that?
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._
Most helpful comment
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.