提交代码到 gitee
一:先确认好自己所在的项目路径是否为根路径,如果不是 通过命令:
cd 路径名
跳转到对应的根路径上
1.上传到码云之前先通过
git status
查看状态
2.查看状态如果报错,通过
git add .
添加所有文件到暂存区 ,存完之后才能提交到码云
3.
git branch
查看当前所在分支
4.通过
git commit -m “xxx”
提交暂存区中的内容到本地仓库 xxx是备注名
5.通过
git push
提交代码到码云
6.
git checkout xxx
切换到xxx分支
二:把代码上传到对应分支之后 需要把分支合并到主分支上
1.先
git checkout master
切换到主分支
2. 通过
git merge rights
合并分支到主分支 rights 为要合并到主分支的分支名
3.通过
git push
把最新合并的分支上传到码云
参考过程如下:
PS C:\Users\森哥是也\Desktop\Vue项目实战\code> cd vue_shop
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git branch
login
master
* rights
user
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git add .
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git commit -m "完成了权限功能开发"
[rights 1d5e445] 完成了权限功能开发
7 files changed, 414 insertions(+), 41 deletions(-)
create mode 100644 src/components/power/Roles.vue
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git push
fatal: unable to access 'https://gitee.com/liu-sen-123/vue_shop.git/': Could not resolve host: gitee.com
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git push
Counting objects: 100% (30/30), done.
Delta compression using up to 8 threads
Compressing objects: 100% (13/13), done.
Writing objects: 100% (17/17), 5.55 KiB | 1.11 MiB/s, done.
Total 17 (delta 7), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.2]
To https://gitee.com/liu-sen-123/vue_shop.git
d34b8d6..1d5e445 rights -> rights
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git merge rights
Updating d34b8d6..1d5e445
Fast-forward
src/App.vue | 6 +-
src/assets/css/global.css | 1 +
src/components/power/Rights.vue | 53 +++++++++
src/components/power/Roles.vue | 236 ++++++++++++++++++++++++++++++++++++++++
src/components/user/Users.vue | 142 +++++++++++++++++-------
src/plugins/element.js | 7 +-
src/router/index.js | 10 ++
7 files changed, 414 insertions(+), 41 deletions(-)
create mode 100644 src/components/power/Rights.vue
create mode 100644 src/components/power/Roles.vue
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git branch
login
* master
rights
user
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git push
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.2]
To https://gitee.com/liu-sen-123/vue_shop.git
d34b8d6..1d5e445 master -> master
创建新的分支
一:先确认好自己所在的项目路径是否为根路径,如果不是 通过命令:
cd 路径名
跳转到对应的根路径上
1.如果是新创建的分支 要加 -b ;通过
git checkout -b
goods_cate 创建名为 goods_cate的新分支
2.通过 git branch 查看当前分支,并检查是否已经创建出最新的分支
3.如果仓库中没有该分支,需要通过 -u 把新创建的分支上传到码云
git push -u origin goods_cate
origin为仓库别名 goods_cate 为分支名
参考过程如下:
PS C:\Users\森哥是也\Desktop\Vue项目实战\code> cd vue_shop
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git branch
login
* master
rights
user
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git checkout -b goods_cate
Switched to a new branch 'goods_cate'
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git branch
* goods_cate
login
master
rights
user
PS C:\Users\森哥是也\Desktop\Vue项目实战\code\vue_shop> git push -u origin goods_cate
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.2]
remote: Create a pull request for 'goods_cate' on Gitee by visiting:
remote: https://gitee.com/liu-sen-123/vue_shop/pull/new/liu-sen-123:goods_cate...liu-sen-123:master
To https://gitee.com/liu-sen-123/vue_shop.git
* [new branch] goods_cate -> goods_cate
Branch 'goods_cate' set up to track remote branch 'goods_cate' from 'origin'.