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

Generated project has a git repo added which doesn't let it add as a submodule to another project #967

Closed
abondar24 opened this issue Mar 9, 2018 · 12 comments

Comments

@abondar24
Copy link

Version

3.0.0-beta.6

Reproduction link

https://github.com/abondar24/SocialTournamentService

Steps to reproduce

Clone and create a new vue app via vue create

What is expected?

App is not added to a bigger project before it's done by git add .

What is actually happening?

.git dir is created and the app is created as a submodule which is tough to maintain.


Either turn off creating a local git repo or add an option while creating. Via the link to my repo you will find the app added as a I wanted. For this I had to ignore registring a VCS root in IntelliJ Idea. Then removed .git dir.

@miljan-aleksic
Copy link

I just run into this as well. I don't expect a cli to init a git, I might not even use git or set the project in a monorepo, etc. I would expect this kind of actions to be optional.

@timwis
Copy link
Contributor

timwis commented Mar 18, 2018

Same here -- in my case, I'm rewriting my app in vue, so I did git checkout --orphan v2 to create a fresh orphan branch. I didn't realise I could use vue create . so I did it in a subdirectory and moved the files up, but noticed that .git directory in there and was surprised.

While it is convenient for a new project, in my opinion, I don't think anyone would expect a git commit to be made from vue-cli. Of course, I've thought about this all of 30 seconds, and I'm sure whoever authored it thought about it plenty more. Just wanted to share my bit of feedback. Thanks for your work on this project -- the cli 3.0 is really handy!

@Spinarooni
Copy link

I definitely think the CLI needs an option to either opt into or out of initializing a git repo on project creation. Would be helpful especially for those that do not use git.

@peteretelej
Copy link

How about checking if already in a git repo, instead of initializing a submodule (since the user seems to have the repo in control)? e.g. via git rev-parse --is-inside-work-tree.

Would be really nice if it didn't create a repo; my current workflow with the cli is:

vue create xyz
cd xyz
rm -rf .git
npm run dev

@quantuminformation
Copy link

Please get rid of the generated .git folder, its the last thing I want to be installed, can I just delete it?)

@Akryum
Copy link
Member

Akryum commented Apr 21, 2018

How about checking if already in a git repo, instead of initializing a submodule

This is a good idea.

Please get rid of the generated .git folder, its the last thing I want to be installed, can I just delete it?

You can delete it, but you will lose change detection after invoking a plugin that modifies your files.

@quantuminformation
Copy link

quantuminformation commented Apr 25, 2018

I don't really get the point of the .git folder, Ember cli and create react app, manages pretty good without a .git folder

Having the previous .git folder messes up my existing git repo and I've spent most of today trying to fix it

13:02	Checked out ae73e9ccc6f59c17d346a33ec4f1b2fb21e62a2f (show balloon)

13:02	Couldn't checkout 064071910d689420fdb5f45847069755b7a757c3: Updating the following directories would lose untracked files in it:

I am not able to re checkout the branch I commited with that git folder above the commit with it:

fatal: bad object 8471141d8a2ba2f16684a1f5d362ada725e5a1d9:quantumjs

@Akryum
Copy link
Member

Akryum commented Apr 25, 2018

I don't really get the point of the .git folder, Ember cli and create react app, manages pretty good without a .git folder

vue-cli plugins are meant to modify your file. Without a .git folder, vue-cli couldn't let you know precisely which file was modified and how, and you couldn't see the changes by yourself and eventually revert some of them thant doesn't suit you.

If you are generating a project in a folder of a git repo, remove the .git folder created by vue-cli.

@quantuminformation
Copy link

Thanks for the clarification. What I will do is just create a new project and upload this direct to the remote.

@timwis
Copy link
Contributor

timwis commented Apr 25, 2018

I don't think anyone is suggesting not to use git for version control; rather that it's something vue-cli shouldn't need to worry about. If a user wants to see the changes, they should make sure to have a clean working tree before running vue add. If they forget to do that, vue-cli will still work but they won't be able to tell it's changes from whatever changes were already uncommitted (same with any other command they run in their terminal that modifies files). It seems like vue-cli is trying to take responsibility for a version control best practice here, and a side-effect is that it breaks things if you use vue create in a directory that already has a git repo. Or am I misunderstanding?

@abondar24
Copy link
Author

abondar24 commented Apr 25, 2018 via email

@posva posva changed the title Generated prjoect has a git repo added which doesn't let it add as a submodule to another project Generated project has a git repo added which doesn't let it add as a submodule to another project Apr 26, 2018
@yyx990803 yyx990803 added scope: cli intend to implement The team has the intention to implement this feature at some point. Contribution is also welcome. priority: next and removed intend to implement The team has the intention to implement this feature at some point. Contribution is also welcome. labels Apr 27, 2018
@yyx990803
Copy link
Member

After c2aac9e:

  • Will no longer initialize git repo if already inside a git repo
  • Can opt-out with --git false
  • Or force git initialization even already inside a git repo with --git
  • Optionally can append initial commit message via --git 'custom message'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants