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
网友评论