如何上传本地项目到github这些就不说了,
今天遇到一个问题是:本机的webpack项目在npm初始化的时候会生成一个node_modules的巨大的库,我们上传到github时是可以忽略它的。
使用Git Bush(同linux)
做开发的电脑上肯定是安装了git的,进入你的webpack项目,在项目下打开你的git bush,命令行输入:
$ touch .gitignore
这样就新建好了一个.gitignore的文件,接下来打开这个gitignore的文件,在里面输入 node_modules
保存并退出,这样提交项目到github时就会忽略node_modules文件夹啦
使用windows下cmd指令
一百度,发现好多命令行都是针对linux的,windows下的cmd根本不管用啊怒摔!!
自己摸索了下发现下面的的指令是可行的:
cd进入你的webpack项目:输入以下指令用于windows下新建一个.gitignore的文件
echo. >.gitignore
这样就新建好了一个.gitignore的文件,打开这个文件,在里面输入node_modules,保存退出,
然后上次你的webpack项目,这是就发现上传的时候已经忽略了node_modules文件夹了