Java微服务项目集成Git云效详细教程

42 阅读2分钟

阿里云Git codeup.aliyun.com/

没有账号的进行注册登录。

一、创建云效组织

二、创建代码仓库

三、生成密钥

如果我们没有配置密钥,那么我们每次pull和push代码的时候都要填写一遍用户名和密码,非常不方便。

一直按回车即可,最后会给你生成一个文件id_rsa.pub,打开后有一串密钥,粘贴这串密钥到云效中:

四、将项目纳入云效管理

cd existing_folder # 进入到项目根目录
git init
git remote add origin git@codeup.aliyun.com:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/dcloud/dcloud-interview.git
git add .
git commit
git push -u origin HEAD

到此,已经将项目纳入了云效进行管理。

五、创建develop分支

现在我们就有两个分支了,master分支是生产环境运行的代码,我们主要在develop分支上进行开发。

六、develop分支创建后的工作流

# 1. 从develop分支创建功能分支
git checkout develop
git pull origin develop
git checkout -b feature/project-init

# 2. 开发功能(多个提交)
git add .
git commit -m "feat(account): 完成项目初始化"


# 3. 推送分支
git push origin feature/project-init

# 4. 创建Pull Request/Merge Request
# 触发CI检查:代码规范、单元测试、集成测试

# 5. 代码审查通过后合并
git checkout develop
git merge --no-ff feature/project-init

# 6. 删除功能分支
git branch -d feature/project-init
git push origin --delete feature/project-init