Headline | uniapp - 黑马优购 (escook.cn)文档
补充:
1、使用 Git 管理项目
在项目根目录中新建 .gitignore 忽略文件,并配置如下:
# 忽略 node_modules 目录
/node_modules # 存放的是第三方的包
/unpackage/dist #编译时自动创建的目录
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp
$ git init #初始化
Initialized empty Git repository in D:/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp/.git/
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$ git status # 查看状态 此时还是红的
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
.hbuilderx/
App.vue
components/
index.html
main.js
manifest.json
pages.json
pages/
static/
uni.scss
uni_modules/
unpackage/
nothing added to commit but untracked files present (use "git add" to track)
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$ git add . #添加
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$ git status #再次查看状态 此时变绿了
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$ git commit -m "init project" #提交
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$ git status #再次查看状态
On branch master
nothing to commit, working tree clean
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$
>ssh -t git@gitee.com #测试公钥是否配置成功
D:\computer\eclipse-apache-tomcat\HX\HX_Project\HX_Demo\hello_uniapp\hello_uniapp>git checkout -b tabbar #创建 tabBar 子分支
Switched to a new branch 'tabbar'
D:\computer\eclipse-apache-tomcat\HX\HX_Project\HX_Demo\hello_uniapp\hello_uniapp>git branch #查看所有分支
master
* tabbar
D:\computer\eclipse-apache-tomcat\HX\HX_Project\HX_Demo\hello_uniapp\hello_uniapp>
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (tabbar)
$ git add . #添加到本地
warning: LF will be replaced by CRLF in pages.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages/cart/cart.vue.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages/cate/cate.vue.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages/home/home.vue.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in pages/my/my.vue.
The file will have its original line endings in your working directory
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (tabbar)
$ git status #查看本地状态
On branch tabbar
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: pages.json
new file: pages/cart/cart.vue
new file: pages/cate/cate.vue
new file: pages/home/home.vue
deleted: pages/index/index.vue
new file: pages/my/my.vue
new file: static/cart_border@2x.png
new file: static/my-icons/icon1.png
new file: static/my-icons/icon2.png
new file: static/my-icons/icon3.png
new file: static/my-icons/icon4.png
new file: static/tab_icons/cart-active.png
new file: static/tab_icons/cart.png
new file: static/tab_icons/cate-active.png
new file: static/tab_icons/cate.png
new file: static/tab_icons/home-active.png
new file: static/tab_icons/home.png
new file: static/tab_icons/my-active.png
new file: static/tab_icons/my.png
new file: static/uni.ttf
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (tabbar)
$ git commit -m "完成了 tabBar 的开发" # 提交到本地
[tabbar 9b4b313] 完成了 tabBar 的开发
20 files changed, 153 insertions(+), 35 deletions(-)
create mode 100644 pages/cart/cart.vue
create mode 100644 pages/cate/cate.vue
create mode 100644 pages/home/home.vue
delete mode 100644 pages/index/index.vue
create mode 100644 pages/my/my.vue
create mode 100644 static/cart_border@2x.png
create mode 100644 static/my-icons/icon1.png
create mode 100644 static/my-icons/icon2.png
create mode 100644 static/my-icons/icon3.png
create mode 100644 static/my-icons/icon4.png
create mode 100644 static/tab_icons/cart-active.png
create mode 100644 static/tab_icons/cart.png
create mode 100644 static/tab_icons/cate-active.png
create mode 100644 static/tab_icons/cate.png
create mode 100644 static/tab_icons/home-active.png
create mode 100644 static/tab_icons/home.png
create mode 100644 static/tab_icons/my-active.png
create mode 100644 static/tab_icons/my.png
create mode 100644 static/uni.ttf
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (tabbar)
$ git status #查看本地状态
On branch tabbar
nothing to commit, working tree clean
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (tabbar)
$ git push -u origin tabbar #将本地的 tabbar 分支推送到远程仓库进行保存
Enumerating objects: 33, done.
Counting objects: 100% (33/33), done.
Delta compression using up to 8 threads
Compressing objects: 100% (25/25), done.
Writing objects: 100% (29/29), 49.75 KiB | 943.00 KiB/s, done.
Total 29 (delta 5), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.3]
remote: Create a pull request for 'tabbar' on Gitee by visiting:
remote: https://gitee.com/zhang_jikuan/hello_uniapp/pull/new/zhang_jikuan:tabbar...zhang_jikuan:master
To gitee.com:zhang_jikuan/hello_uniapp.git
* [new branch] tabbar -> tabbar
Branch 'tabbar' set up to track remote branch 'tabbar' from 'origin'.
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (tabbar)
$ git branch #查看分支
master
* tabbar
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (tabbar)
$ git checkout master #切换到master 分支
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$ git merge tabbar #合并tabbar 分支的代码
Updating f8994c9..9b4b313
Fast-forward
pages.json | 71 +++++++++++++++++++++++++++++++++++----
pages/cart/cart.vue | 22 ++++++++++++
pages/cate/cate.vue | 22 ++++++++++++
pages/home/home.vue | 22 ++++++++++++
pages/index/index.vue | 29 ----------------
pages/my/my.vue | 22 ++++++++++++
static/cart_border@2x.png | Bin 0 -> 2758 bytes
static/my-icons/icon1.png | Bin 0 -> 1889 bytes
static/my-icons/icon2.png | Bin 0 -> 1825 bytes
static/my-icons/icon3.png | Bin 0 -> 2027 bytes
static/my-icons/icon4.png | Bin 0 -> 1469 bytes
static/tab_icons/cart-active.png | Bin 0 -> 2195 bytes
static/tab_icons/cart.png | Bin 0 -> 2873 bytes
static/tab_icons/cate-active.png | Bin 0 -> 3330 bytes
static/tab_icons/cate.png | Bin 0 -> 4219 bytes
static/tab_icons/home-active.png | Bin 0 -> 2210 bytes
static/tab_icons/home.png | Bin 0 -> 3305 bytes
static/tab_icons/my-active.png | Bin 0 -> 2691 bytes
static/tab_icons/my.png | Bin 0 -> 3997 bytes
static/uni.ttf | Bin 0 -> 26164 bytes
20 files changed, 153 insertions(+), 35 deletions(-)
create mode 100644 pages/cart/cart.vue
create mode 100644 pages/cate/cate.vue
create mode 100644 pages/home/home.vue
delete mode 100644 pages/index/index.vue
create mode 100644 pages/my/my.vue
create mode 100644 static/cart_border@2x.png
create mode 100644 static/my-icons/icon1.png
create mode 100644 static/my-icons/icon2.png
create mode 100644 static/my-icons/icon3.png
create mode 100644 static/my-icons/icon4.png
create mode 100644 static/tab_icons/cart-active.png
create mode 100644 static/tab_icons/cart.png
create mode 100644 static/tab_icons/cate-active.png
create mode 100644 static/tab_icons/cate.png
create mode 100644 static/tab_icons/home-active.png
create mode 100644 static/tab_icons/home.png
create mode 100644 static/tab_icons/my-active.png
create mode 100644 static/tab_icons/my.png
create mode 100644 static/uni.ttf
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$ git push #提交到远程仓库
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.3]
To gitee.com:zhang_jikuan/hello_uniapp.git
f8994c9..9b4b313 master -> master
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$ git branch #仓库分支
* master
tabbar
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$ git branch -d tabbar #删除tabbar 分支 ,-d 表示本地仓库,删除tabbar 分支必须在其他分支上才可以删除
Deleted branch tabbar (was 9b4b313).
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$ git branch #查看分支
* master
String@DESKTOP-KBPBMEV MINGW64 /d/computer/eclipse-apache-tomcat/HX/HX_Project/HX_Demo/hello_uniapp/hello_uniapp (master)
$
D:\computer\eclipse-apache-tomcat\HX\HX_Project\HX_Demo\hello_uniapp\hello_uniapp>npm init -y #初始化npm
Wrote to D:\computer\eclipse-apache-tomcat\HX\HX_Project\HX_Demo\hello_uniapp\hello_uniapp\package.json:
{
"name": "hello_uniapp",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@gitee.com:zhang_jikuan/hello_uniapp.git"
},
"keywords": [],
"author": "",
"license": "ISC"
}
D:\computer\eclipse-apache-tomcat\HX\HX_Project\HX_Demo\hello_uniapp\hello_uniapp>