一、概念
1.软件开发的生命周期(简约版)
- 项⽬⽴项–>需求调研–>需求拆解–>交给不同的开发进⾏开发–>测试环境测试–>部署⽣产环
境。

2.环境的概念
- 开发环境:开发电脑所使用的环境。一般看是什么工程师(java、go、python)
- 测试环境:一般由测试人员自己来部署,然后在该环境经行测试。((必不可少 -->系
统、软件、版本等,都和⽣产环境⼀致。)
- 预⽣产环境:测试到⽣产环境的⼀个过渡。 ( 连接的是⽣产库。 与⽣产的域名不同。
test.jd.com) ,保证产品的质量。
- ⽣产环境:即线上环境,⽤户使⽤的环境,⼀般是运维在维护,其他⼈员⼏乎⽆权限。
3.环境和环境之间的代码是如何部署的
- 手动:效率低、⼲扰因素多、不安全
-
- rz的方式
-
- scp、xftp的方式等等
-
- 登录到代码托管平台,svn pull、git pull。
- 缺陷:
-
- 全程运维参与,占用大量时间。
-
- 如果节点多,上线速度慢。
-
- 认为失误多,目录管理混乱。
-
- 回滚不及时,或者难以回退。
- 自动:效率高、干扰较为少、安全
-
- 持续集成(简单⼯作、产品能快速迭代、保证⾼质量的产品。)

-
- 持续交付

- 持续部署

- 完整代码发布流程

二、git分布式版本控制软件

第一阶段:单兵作战
[root@git dy]
[root@git dy]
[root@git dy]
[root@git ~]
[root@git ~]
[root@git dy]
[root@git dy]
[root@git dy]
[root@git dy]
[root@git dy]

第二阶段:开发新功能
[root@git dy]
[root@git dy]
[root@git dy]
[root@git dy]
[master 7285d97] 直播功能上线
1 file changed, 1 insertion(+)
第三阶段:再次上线新功能
[root@git dy]
[root@git dy]
[root@git dy]
[master a901f68] 约饭功能上线.
1 file changed, 1 insertion(+)
回退功能或者重新上线
[root@git dy]
[root@git dy]
HEAD 现在位于 7285d97 直播功能上线
[root@git dy]
1.完成抖⾳短视频功能
2.完成直播功能
[root@git dy]
7285d97 HEAD@{0}: reset: moving to 7285d97a63fe259a2fdcda7ef5bc91d5e400dc15
a901f68 HEAD@{1}: commit: 约饭功能上线.
7285d97 HEAD@{2}: commit: 直播功能上线
0838f2b HEAD@{3}: commit: adasdas
83d2495 HEAD@{4}: commit (initial): 短视频功能开发完毕
[root@git dy]
[root@git dy]
[root@git dy]
HEAD 现在位于 a901f68 约饭功能上线.
[root@git dy]
1.完成抖⾳短视频功能
2.完成直播功能
3.约饭功能完成
总结
git init #初始化⼀个⽬录为git版本库
git add . #将没有被管理的⽂件,加⼊git管理,添加到暂存区
git commit -m "描述" #将暂存区的⽂件提交到版本库中,进⾏版本的管理
git log #查看提交的历史记录
git reflog #查看git提交的所有历史记录
git status #查看当前的⽂件管理状态(已提交|未提交)
git reset --hard commitID #回退到指定的提交版本记录

第四阶段:游戏功能&bug修复
分支:

[root@git dy]
[root@git dy]
game
* master
[root@git dy]
切换到分⽀ 'game'
[root@git dy]
1.完成抖⾳短视频功能
2.完成直播功能
3.约饭功能完成
[root@git dy]
[root@git dy]
[root@git dy]
[game e2f86a8] 游戏完成20%-c3
1 file changed, 2 insertions(+)
[root@git dy]
[root@git dy]
[root@git dy]
[game 3b3f2fc] 游戏完成50%-c4
1 file changed, 1 insertion(+)
修复bug
[root@git dy]
[root@git dy]
切换到分⽀ 'bug'
[root@git dy]
[root@git dy]
[root@git dy]
[bug 0861ff4] 约bug修复-c5
1 file changed, 1 insertion(+), 1 deletion(-)
[root@git dy]
切换到分⽀ 'master'
[root@git dy]
的最新代码
更新 a901f68..0861ff4
Fast-forward
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[root@git dy]
切换到分⽀ 'game'
[root@git dy]
[root@git dy]
[root@git dy]
[game d0790cc] 游戏完成100%
1 file changed, 1 insertion(+)
[root@git dy]
[root@git dy]
[root@git dy]
[root@git dy]
[game a9d322f] bug修复-游戏-c8
[root@git dy]
[root@git dy]
更新 0861ff4..a9d322f
Fast-forward
index.html | 4 ++++
1 file changed, 4 insertions(+)
第五阶段:进军三里屯
( Linux 模拟 家)
( MacOS | Windows-git-bash客户端 模拟三⾥屯 )
1.安装windows的git客户端
2,注册⼀个gitee的账户,并登陆
第一天上班前在家上传代码(Linux)


1. 给远程仓库起别名
git remote add origin 远程仓库地址
2. 向远程推送代码
git push -u origin 分⽀
初次在公司新电脑下载代码(MacOS|Windows)
xudeMacBook-Pro:douyin xuliangwei$ git clone
https://gitee.com/oldboy_oldxu/douyin.git
xudeMacBook-Pro:douyin xuliangwei$
xudeMacBook-Pro:douyin xuliangwei$ git add .
xudeMacBook-Pro:douyin xuliangwei$ git commit -m ""
xudeMacBook-Pro:douyin xuliangwei$ git push origin master
下班回家继续写代码(Linux)
[root@git dy]
如何推送其他分支代码
[root@git dy]
[root@git dy]
[root@git dy]
[root@git dy]
[root@git dy]
知识补充和总结
git pull origin master| dev | game
等价于
git fetch origin dev
git merge origin/dev

小总结:
添加远程连接(别名)
git remote add origin 地址
git remote -v
git remote remove origin #删除当前origin这个别名 (相当于本地版本库与中⼼版本库取消关联)
推送代码
git push origin 分⽀名称
下载代码
git pull origin 分⽀名称
相当于
git fetch origin 分⽀名称
git merge origin/分⽀名称
第六阶段:其他知识补充
[root@git dy]
[root@git dy]
v1.1
[root@git dy]
Username for 'https://gitee.com': 552408925@qq.com
Password for 'https://[email protected]@gitee.com':
[root@git dy]
[root@git dy]
- url中体现
原来的地址:https://gitee.com/oldxu/treenb.git
修改的地址:https://⽤户名:密码@gitee.com/oldxu/treenb.git
git remote add origin https://⽤户名:密码@github.com/oldxu/treenb.git
git push origin master
- ssh中实现


将我们的公钥添加到gitee上,就可以实现免密登陆。
[root@git dy]
origin https://gitee.com/oldboy_oldxu/douyin.git (fetch)
origin https://gitee.com/oldboy_oldxu/douyin.git (push)
[
[root@git dy]
[root@git dy]
[root@git dy]
git@gitee.com:oldboy_oldxu/douyin.git
[root@git dy]
origin git@gitee.com:oldboy_oldxu/douyin.git (fetch)
origin git@gitee.com:oldboy_oldxu/douyin.git (push)
[root@git dy]
[root@git dy]
*.pyc
https://github.com/github/gitignore