Vue笔记整理,10.项目-把本地项目托管到码云中

 

在公司都是团队开发,下面我们来介绍下git代码管理工具

首先,我们需要创建几个文件

 

1、.gitignore 项目忽略文件

我们在项目中像 node_modules 这些文件没必要上传到,我们的源代码仓库当中

node_modules 项目依赖文件,体积比较大

.idea 它是一个文件夹,里面放了你自己webstorm工具相关的配置,如快捷键等,每个人都不一样

.vscode 这个类似.idea,它是VScode工具相关的配置

.git 存了一些版本信息,也没必要上传

.DS_Store  mac系统自带文件

 

2、README.md 项目描述文件

 

3、有关开源协议

可参照 mui-master中 LICENSE 文件,把它拷贝到项目里面。

打开 LICENSE 文件协议,我们可以看到它使用的 MIT 协议,

能不能够:免费使用、分发、二次开发等,可参考如下链接:

[主流开源协议之间有何异同?] (https://www.zhihu.com/question/19568896)

 

4、有关 git 命令

git init 
在项目中初始化git,执行此命令后,
会在项目目录下生成一个 .git 的隐藏文件夹

$ git status
On branch master
 
No commits yet
 
Untracked files:
  (use "git add <file>..." to include in what will be committed)
 
        .babelrc
        dist/
        node_modules/
        package.json
        src/
        webpack.config.js
        "\345\205\210\350\277\220\350\241\214 npm install \345\256\211\350\243\205\344\276\235\350\265\226\345\214\205.txt"
 
nothing added to commit but untracked files present (use "git add" to track)

展示所有文件的状态。标红的,都是未提交的文件。

Untracked files 即没有被跟踪的文件。那么我们把它添加到跟踪文件

$ git add .
git add . 会把本地所有untrack的文件都加入暂存区,并且会根据.gitignore做过滤。
 

 

我们再来看一下文件状态,都变为 new file 了,还没有被提交

$ git status
On branch master
 
No commits yet
 
Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
 
        new file:   .babelrc
        new file:   .gitignore
        new file:   dist/bundle.js
        new file:   package.json
        new file:   src/App.vue
        new file:   src/index.html
        new file:   src/lib/mui/css/mui.css
        new file:   src/lib/mui/css/mui.min.css
        new file:   src/lib/mui/fonts/mui.ttf
        new file:   src/lib/mui/js/mui.js
        new file:   src/lib/mui/js/mui.min.js
        new file:   src/main.js
        new file:   src/router.js
        new file:   webpack.config.js
        new file:   "\345\205\210\350\277\220\350\241\214 npm install \345\256\211\350\243\205\344\276\235\350\265\226\345\214\205.txt"
 

 

然后我们进行提交

$ git commit -m "init my project"
[master (root-commit) 2d66597] init my project
16 files changed, 14189 insertions(+)
create mode 100755 .babelrc
create mode 100644 .gitignore
create mode 100755 dist/bundle.js
create mode 100755 package.json
create mode 100755 src/App.vue
create mode 100755 src/index.html
create mode 100755 src/lib/mui/css/mui.css
create mode 100755 src/lib/mui/css/mui.min.css
create mode 100755 src/lib/mui/fonts/mui.ttf
create mode 100755 src/lib/mui/js/mui.js
create mode 100755 src/lib/mui/js/mui.min.js
create mode 100755 src/main.js
create mode 100755 src/router.js
create mode 100755 webpack.config.js
create mode 100755 "\345\205\210\350\277\220\350\241\214 npm install \345\256\211\350\243\205\344\276\235\350\265\226\345\214\205.txt"
 

 

提交成功以后,我们再来看一下状态

$ git status
On branch master
nothing to commit, working tree clean
 

意思:当前在 master 主分支上,没有任何修改可提交,工作目录是干净的。

此时,我们只是把项目提交到本地的 .git 里面去了

它没有跟远端的仓库作任何关联,如果要把它上传到远端仓库,

我们可以选择:github 或 gitee(码云),它们区别不大

github:服务器在国外,相对较多牛逼的开源项目,速度相对较慢

https://github.com/

gitee(码云):服务器在国内,开源项目相对较少,上传下载速度相对比较快

https://gitee.com 

 

下面我们来演示关联 gitee平台来上传下载代码

把公钥放到gitee上面,详细可参考:原创 git实战笔记系列:生成 ssh 公钥,查看获取放到github或gitee上

点击加号,新建仓库

 

 

如我写的仓库名称:vue-cms-yyh

 

出现如下类似界面,就说明创建仓库成功了

 

 

更新中。。。

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章