git flow

Git workflow

# 预备:检查`git`版本不应低于2.6(可使用homebrew安装最新版)
git version

# 一般开发都应该在单独的分支开发,我们从最新的基础分支中checkout出来一个开发分支:
git checkout development
git pull
git checkout -b your-new-feature

# 进行开发~~
vim app/index.html

# 定期提交保存
git add app/index.html
git commit -m 'edit homepage'

# 对于长周期开发的分支,要定时合并基础分支的代码
git checkout development
git pull
git checkout your-new-feature
git merge development

# 开发完成后推送到Github并创建pull request(简称pr)
git push -u origin your-new-feature:your-name/your-new-feature # 注意远程分支加namespace
# 在Github的web界面创建pr,assign给reviewer,找ta review

# 根据review意见调整代码、再提交推送、再review,直到review通过
vim app/index.html
git add app/index.html
git commit -m 'fix code style according to review'
git push

# review通过后在本地将代码合并到基础分支
git checkout development
git pull
git merge --squash your-new-feature
git commit -m 'Update homepage'
git push

# 删除本地和远程的开发分支
git branch -D your-new-feature
git push origin :your-name/your-new-feature

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容