Github Flow 文檔

文檔地址


前言

GitHub Flow is a lightweight, branch-based workflow that supports teams and projects where deployments are made regularly. This guide explains how and why GitHub Flow works.

GitHub Flow 是一個基于分支的輕量級工作流噪猾。它適用于團隊開發(fā)與定期需要發(fā)布的項目租幕。這個文檔解釋了如何使用與為何使用github flow柳沙。

1.Create a branch 創(chuàng)建分支

Create a branch.png

When you're working on a project, you're going to have a bunch of different features or ideas in progress at any given time – some of which are ready to go, and others which are not. Branching exists to help you manage this workflow.
When you create a branch in your project, you're creating an environment where you can try out new ideas. Changes you make on a branch don't affect the master branch, so you're free to experiment and commit changes, safe in the knowledge that your branch won't be merged until it's ready to be reviewed by someone you're collaborating with.
開發(fā)項目的時候,你可能需要創(chuàng)建分支去支持一些新特性,實現(xiàn)一些新想法蜕窿。但是有些分支是可以發(fā)布部署的,有些則沒有準備好。branch就是為了解決這個問題存在的腐泻。在項目里創(chuàng)建了一個新的分支,意味著你可以在新分支里面嘗試新的想法队询。
分支的任何改動派桩,不會影響master主分支。所以你可以盡情的改動娘摔,嘗試并且comm你的改動窄坦。但是如果你想merge分支,你得確認你的代碼可以被合作者們review.
ProTip
Branching is a core concept in Git, and the entire GitHub flow is based upon it. There's only one rule: anything in the master branch is always deployable.
branch-分支是git中的核心概念凳寺。整個Github flow 都基于branch鸭津。而且準則只有一個:任何主分支的內(nèi)容都是可部署的。
Because of this, it's extremely important that your new branch is created off of master when working on a feature or a fix. Your branch name should be descriptive (e.g., refactor-authentication, user-content-cache-key, make-retina-avatars), so that others can see what is being worked on.
也正是因為如此肠缨,在主分支以外創(chuàng)建新分支去處理問題與實現(xiàn)新需求是及其重要的逆趋。分支命名記得需要規(guī)范易懂,這樣便于合作開發(fā)晒奕。

2.Add commits 創(chuàng)建分支

Add commits.png

Once your branch has been created, it's time to start making changes. Whenever you add, edit, or delete a file, you're making a commit, and adding them to your branch. This process of adding commits keeps track of your progress as you work on a feature branch.
Commits also create a transparent history of your work that others can follow to understand what you've done and why. Each commit has an associated commit message, which is a description explaining why a particular change was made. Furthermore, each commit is considered a separate unit of change. This lets you roll back changes if a bug is found, or if you decide to head in a different direction.
創(chuàng)建了new branch闻书,你就可以在該分支進行內(nèi)容的改動。添加刪除改動文件脑慧,意味著你也要提交改動并且改動需要被添加到branch中魄眉。
提交都是有完整詳細的記錄,任何資源的修改都有闷袒。它的意義在于告訴別人你做了什么操作坑律,以及為什么。
每個commit對有對應的詳細說明囊骤。說明需要解釋你做了什么改動晃择,為什么改動冀值。而且,每個commit都可以被視為change的一個小組成單元宫屠。這有助于你回溯來改BUG列疗。
ProTip
Commit messages are important, especially since Git tracks your changes and then displays them as commits once they're pushed to the server. By writing clear commit messages, you can make it easier for other people to follow along and provide feedback.
commit的說明非常重要,因為代碼連同改動和說明都被推送到服務(wù)器(一旦被推到server,git追蹤的改動會被顯示為commits)浪蹂。書寫清晰易懂的說明有助于他人理解你的改動抵栈。

3.Open a Pull Request

Open a Pull Request.png

Pull Requests initiate discussion about your commits. Because they're tightly integrated with the underlying Git repository, anyone can see exactly what changes would be merged if they accept your request.
You can open a Pull Request at any point during the development process: when you have little or no code but want to share some screenshots or general ideas, when you're stuck and need help or advice, or when you're ready for someone to review your work. By using GitHub's @mention system in your Pull Request message, you can ask for feedback from specific people or teams, whether they're down the hall or ten time zones away.
Pull requests 等于創(chuàng)建了一個會話,專門討論你的commits乌逐。因為他們和基礎(chǔ)git倉庫是緊密集成的竭讳,所以任何人都可以了解到他們在合并代碼之后會有哪些改動。
你可以在任何時候開啟pull request:截屏浙踢,新想法绢慢,需要幫助都可以。(所以pull request本質(zhì)上就是一種機制洛波,讓當前的開發(fā)者告訴其余成員胰舆,一個功能已經(jīng)完成。維護者合并之后關(guān)閉這個PR蹬挤。)
ProTip
Pull Requests are useful for contributing to open source projects and for managing changes to shared repositories. If you're using a Fork & Pull Model, Pull Requests provide a way to notify project maintainers about the changes you'd like them to consider. If you're using a Shared Repository Model, Pull Requests help start code review and conversation about proposed changes before they're merged into the master branch.
Pull Requests在向開源項目貢獻代碼缚窿,管理共享項目的改動的時候都很管用。Pull Requests提供了一個機制幫助開發(fā)者們在合并代碼到master分支之前充分討論和code review焰扳。

4.Discuss and review your code

Discuss and review your code.png

Once a Pull Request has been opened, the person or team reviewing your changes may have questions or comments. Perhaps the coding style doesn't match project guidelines, the change is missing unit tests, or maybe everything looks great and props are in order. Pull Requests are designed to encourage and capture this type of conversation.
You can also continue to push to your branch in light of discussion and feedback about your commits. If someone comments that you forgot to do something or if there is a bug in the code, you can fix it in your branch and push up the change. GitHub will show your new commits and any additional feedback you may receive in the unified Pull Request view.
Pull Request 開啟之后倦零,review你代碼和改動的人會對相關(guān)內(nèi)容有疑問,例如代碼風格不符合標準吨悍,缺少單元測試扫茅。Pull Request 設(shè)計的初衷就是鼓勵這種類型的討論。
Pull Request發(fā)起之后你仍然可以繼續(xù)提交改動到branch育瓜。Github會顯示你最新的commits葫隙。
ProTip
Pull Request comments are written in Markdown, so you can embed images and emoji, use pre-formatted text blocks, and other lightweight formatting.
Pull Request使用的是markdown,所以你可以放emoji和images等等等等躏仇。

5.Deploy


圖像.png

With GitHub, you can deploy from a branch for final testing in production before merging to master.
Once your pull request has been reviewed and the branch passes your tests, you can deploy your changes to verify them in production. If your branch causes issues, you can roll it back by deploying the existing master into production.
在github上你可以在branch合并到master分支上之前恋脚,進行測試等配置。一切都OK了焰手,就可以進行部署了糟描。發(fā)生任何問題你都可以回滾。

6.Merge

merge.png

Now that your changes have been verified in production, it is time to merge your code into the master branch.
Once merged, Pull Requests preserve a record of the historical changes to your code. Because they're searchable, they let anyone go back in time to understand why and how a decision was made.
現(xiàn)在所有的改動都已經(jīng)被驗證過书妻,可以把代碼合并到主分支船响。一旦合并, Pull Requests會保存你更改的歷史記錄。因為他們是可查詢的灿意。這樣對任何人來說,記錄都是可回溯的崇呵。
ProTip
By incorporating certain keywords into the text of your Pull Request, you can associate issues with code. When your Pull Request is merged, the related issues are also closed. For example, entering the phrase Closes #32 would close issue number 32 in the repository. For more information, check out our help article.
通過把特定關(guān)鍵詞合并到你的Pull Request缤剧,你可以將code和issue關(guān)聯(lián)。當你的Pull Request被合并之后域慷,相關(guān)的issues會被closed荒辕。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市犹褒,隨后出現(xiàn)的幾起案子抵窒,更是在濱河造成了極大的恐慌,老刑警劉巖叠骑,帶你破解...
    沈念sama閱讀 218,284評論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件李皇,死亡現(xiàn)場離奇詭異,居然都是意外死亡宙枷,警方通過查閱死者的電腦和手機掉房,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,115評論 3 395
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來慰丛,“玉大人卓囚,你說我怎么就攤上這事∽绮。” “怎么了哪亿?”我有些...
    開封第一講書人閱讀 164,614評論 0 354
  • 文/不壞的土叔 我叫張陵,是天一觀的道長贤笆。 經(jīng)常有香客問我蝇棉,道長,這世上最難降的妖魔是什么苏潜? 我笑而不...
    開封第一講書人閱讀 58,671評論 1 293
  • 正文 為了忘掉前任银萍,我火速辦了婚禮,結(jié)果婚禮上恤左,老公的妹妹穿的比我還像新娘贴唇。我一直安慰自己,他們只是感情好飞袋,可當我...
    茶點故事閱讀 67,699評論 6 392
  • 文/花漫 我一把揭開白布戳气。 她就那樣靜靜地躺著,像睡著了一般巧鸭。 火紅的嫁衣襯著肌膚如雪瓶您。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,562評論 1 305
  • 那天,我揣著相機與錄音呀袱,去河邊找鬼贸毕。 笑死,一個胖子當著我的面吹牛夜赵,可吹牛的內(nèi)容都是我干的明棍。 我是一名探鬼主播,決...
    沈念sama閱讀 40,309評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼寇僧,長吁一口氣:“原來是場噩夢啊……” “哼摊腋!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起嘁傀,我...
    開封第一講書人閱讀 39,223評論 0 276
  • 序言:老撾萬榮一對情侶失蹤兴蒸,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后细办,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體橙凳,經(jīng)...
    沈念sama閱讀 45,668評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,859評論 3 336
  • 正文 我和宋清朗相戀三年笑撞,在試婚紗的時候發(fā)現(xiàn)自己被綠了痕惋。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,981評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡娃殖,死狀恐怖值戳,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情炉爆,我是刑警寧澤堕虹,帶...
    沈念sama閱讀 35,705評論 5 347
  • 正文 年R本政府宣布,位于F島的核電站芬首,受9級特大地震影響赴捞,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜郁稍,卻給世界環(huán)境...
    茶點故事閱讀 41,310評論 3 330
  • 文/蒙蒙 一赦政、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧耀怜,春花似錦恢着、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,904評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至左痢,卻和暖如春靡羡,著一層夾襖步出監(jiān)牢的瞬間系洛,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,023評論 1 270
  • 我被黑心中介騙來泰國打工略步, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留描扯,地道東北人。 一個月前我還...
    沈念sama閱讀 48,146評論 3 370
  • 正文 我出身青樓趟薄,卻偏偏與公主長得像荆烈,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子竟趾,可洞房花燭夜當晚...
    茶點故事閱讀 44,933評論 2 355

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

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,332評論 0 10
  • Lesson 3: Using GitHub to Collaborate 3.1 Creating a GitH...
    赤樂君閱讀 6,071評論 3 11
  • 前言:這個是官方教程,看完覺得寫的挺淺顯易懂的,于是翻譯一下給需要的人,本人才疏學淺,有翻譯的不到位的地方歡迎指正...
    道阻且長_行則將至閱讀 1,522評論 0 9
  • “等待最后一眼,最后一遍宫峦,最后一天岔帽,最后一點,滴滴答答导绷,消失的時間犀勒,最后這場愛情,難逃浩劫......” ...
    來聽香閱讀 456評論 0 1
  • 姓名:張昱寧 公司:上海緣綴包裝材料有限公司 六項精進313期學員 【日精進打卡第227天】 【知~學習】 《六項...
    聽風煮酒閱讀 176評論 0 0