git Git忽略离子项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30329490/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git ignore for ionic project
提问by NHTorres
I'm somewhat new applications with ionic and very new to the subject of the repositories, when I do a commit endless files are uploaded that I find it very difficult to identify what are the changes in the project, that's why I wanted ask for help here, if I can guide you ignore files, if a file exists by default to occupy and where, since most of the work is done in the www folder. Sorry if the question is very basic but I would serve far solve this problem.
我是一些带有 ionic 的新应用程序,并且对存储库的主题非常陌生,当我提交无限文件时,我发现很难确定项目中有哪些变化,这就是我想要寻求帮助的原因在这里,如果我能指导你忽略文件,如果一个文件存在默认占用和位置,因为大部分工作都是在www文件夹中完成的。对不起,如果问题很基本,但我会远远解决这个问题。
回答by Non
The problem here is that if you already add all those files, once you put the .gitignore
it will not work as you want. You need to put the .gitignore
at the very beginning of your project.
这里的问题是,如果您已经添加了所有这些文件,一旦您将.gitignore
其放入,它将无法正常工作。您需要将 放在.gitignore
项目的开头。
So, my advise: make another project in Git, just upload your project again and create the .gitignore
file. I am telling you this based on my own experience.
所以,我的建议是:在 Git 中创建另一个项目,只需再次上传您的项目并创建.gitignore
文件。我是根据我自己的经验告诉你的。
The basics of what you should put in that .gitignore
你应该放什么的基础知识 .gitignore
node_modules
.tmp
.sass-cache
**/bower_components or sometimes it is lib/**
platforms
plugins
*.swp
*.swo
*.log
*.DS_Store
in order to create this file, you can do it from Git, or from your terminal:
为了创建这个文件,你可以从 Git 或终端中完成:
- In Terminal, navigate to the location of your Git repository.
- Enter
$ touch .gitignore
to create a.gitignore
file.
- 在终端中,导航到 Git 存储库的位置。
- 输入
$ touch .gitignore
以创建.gitignore
文件。
回答by darkdefender27
When using Ionic 2, the scaffolder (starter) project provides you a .gitignore file out of the box. It pretty much covers all the essential files that one wishes to untrack.
使用 Ionic 2 时,脚手架(启动器)项目为您提供了一个开箱即用的 .gitignore 文件。它几乎涵盖了人们希望取消跟踪的所有基本文件。
The .gitignore file present in your starter project should look like this:
启动项目中的 .gitignore 文件应如下所示:
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore
*~
*.sw[mnpcod]
*.log
*.tmp
*.tmp.*
log.txt
*.sublime-project
*.sublime-workspace
.vscode/
npm-debug.log*
.idea/
.sass-cache/
.tmp/
.versions/
coverage/
dist/
node_modules/
tmp/
temp/
hooks/
platforms/
plugins/
plugins/android.json
plugins/ios.json
www/
$RECYCLE.BIN/
.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate
For how to boot up a scaffolder Ionic 2 project, given that you have all the pre-requisite npm modules installed:
关于如何启动一个脚手架 Ionic 2 项目,假设你已经安装了所有先决条件的 npm 模块:
$ ionic start MyProject --v2
Inside the new directory MyProject/ created just now, you'll find the default .gitignore that comes with this starter/template project structure.
在刚刚创建的新目录 MyProject/ 中,您将找到此启动器/模板项目结构附带的默认 .gitignore。
回答by Codelord
You can use this gitignore
你可以使用这个 gitignore
node_modules/
temp/
*.DS_Store
*.log
*.swp
For more details view this link http://forum.ionicframework.com/t/whats-a-good-gitignore-for-an-ionic-project/4115
有关更多详细信息,请查看此链接http://forum.ionicframework.com/t/whats-a-good-gitignore-for-an-ionic-project/4115