git flow

Git workflow

# 預(yù)備:檢查`git`版本不應(yīng)低于2.6(可使用homebrew安裝最新版)
git version

# 一般開發(fā)都應(yīng)該在單獨(dú)的分支開發(fā),我們從最新的基礎(chǔ)分支中checkout出來一個(gè)開發(fā)分支:
git checkout development
git pull
git checkout -b your-new-feature

# 進(jìn)行開發(fā)~~
vim app/index.html

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

# 對(duì)于長(zhǎng)周期開發(fā)的分支,要定時(shí)合并基礎(chǔ)分支的代碼
git checkout development
git pull
git checkout your-new-feature
git merge development

# 開發(fā)完成后推送到Github并創(chuàng)建pull request(簡(jiǎn)稱pr)
git push -u origin your-new-feature:your-name/your-new-feature # 注意遠(yuǎn)程分支加namespace
# 在Github的web界面創(chuàng)建pr,assign給reviewer,找ta review

# 根據(jù)review意見調(diào)整代碼、再提交推送、再review,直到review通過
vim app/index.html
git add app/index.html
git commit -m 'fix code style according to review'
git push

# review通過后在本地將代碼合并到基礎(chǔ)分支
git checkout development
git pull
git merge --squash your-new-feature
git commit -m 'Update homepage'
git push

# 刪除本地和遠(yuǎn)程的開發(fā)分支
git branch -D your-new-feature
git push origin :your-name/your-new-feature

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容