【Git使用学习】本地项目更改以及相对应的Github操作
接上一节,因为是vue项目,导致有很多的node_modules需要安装,如果将这个文件夹也一同上传到github中,太慢了。因此上一节将这个文件夹删除了。
但是,在本地运行的时候,这个文件夹不能删,不然就跑不起来了。突然想到,git有一个可以忽略上传文件的设置。
根目录下创建.gitignore添加需要忽略的文件(夹)名即可。
node_modules/


—————————— 分割线
ok,现在开始打开这个本地项目(vscode),再开始修改。同样这里加上Cesium的学习。


这里想实现的是,Cesium加载JSON数据。
STEP 1:将JSON文件添加到项目中。

STEP 2:在cesiumtest.vue中添加代码,运行即可。
viewer.dataSources.add(
Cesium.GeoJsonDataSource.load('./01_us.json')
)

STEP 3:VsCode的优点这时候就显现出来了,这个文件修改的部分,都出现了提示,同时在【源代码管理】侧边栏也有对应的提示。


前后对比
STEP 4:添加至缓存与提交
接下来,我们可以直接点击提交,这样就相当于执行了下面两个操作
git add .
git commit -m ""
也可以先将项目添加到本地仓库
点击文件旁边的➕即可。
在这里直接点击提交。

更改日志
这时候,github并没有变化。

再点击同步更改看看。

更改成功。
下一节看看在github当前的状态下,下载上一个版本的项目(无json数据)。