推荐软件或者直接终端
⚠️注意:在确保远程和本地分支都可使用的情况下
git常见使用命令
ls---查看所有目录
pwd---本机密码
cd 目录名---进入目录
Touch ---创建文本文件
git status---查看状态
git branch---查看分支
git pull---拉取远程最新代码
git checkout -b 分支名---创建分支
git checkout---切换分支
git push---推送到远程
git add . ---提交所有内容
git commit -m "随意名"---提交到本地
git rebase 用于将一个分支的更改应用到另一个分支上
实际操作
Last login: Fri Nov 15 15:08:02 on ttys002
tal@TALdeMacBook-Pro ~ % ls
Desktop Library Pictures Sites
Documents Movies Postman mock_project
Downloads Music Public works
tal@TALdeMacBook-Pro ~ % cd works
tal@TALdeMacBook-Pro works % ls
cms-admin-fe vue-mapshare 3
study-operate 笔记
study-service-new 课程管理 - 学习机平台_files
tal@TALdeMacBook-Pro works % cd study-service-new
tal@TALdeMacBook-Pro study-service-new % git status
On branch ddj_dev_v10.1
Your branch is up to date with 'origin/ddj_dev_v10.1'.
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Changes to be committed:
modified: src/views/studentsManage/courseDetail/PointsDetailsList.vue
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: src/views/studentsManage/config.js
both modified: src/views/studentsManage/tabIndex.vue
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: src/views/studentsManage/components/adjustIntegralDialog.vue
modified: src/views/studentsManage/courseDetail/PointsDetailsList.vue
tal@TALdeMacBook-Pro study-service-new % git branch
ddj_dev
* ddj_dev_v10.1
dev-ddj
master
release
xf-main-v10.0
xf-main-v11
tal@TALdeMacBook-Pro study-service-new % git checkout xf-main-v11
上线流程
系统上线流程
git branch---查看当前分支
git status----查看修改的文件
git add .---提交所有内容
git commit -m "名称"---提交本地
git push---推送到远程分支
git branch---查看当前分支(自己的开发分支)
git checkout "分支名" 切换到主分支(实际开发的分支)
git pull---拉取
git merge "当前分支" 把当前分支合并到主分支
git status查看修改的文件
git add .
git commit -m "名称"
git pull---拉取(习惯查看其他人更新合并代码)
git push---推送
git branch---查看当前分支(主分支)
git checkout release---切换到上线分支(release):主要是起规范效果
git pull---拉取
git merge "主分支"---当前分支合并到release
git push---推送
git checkout "当前分支(开发分支)"
git merge "主分支"---合并最新的代码
⚠️注意:上线流程仅供参考