# Git Flow 開發方式

## 為什麼要有 Git Flow ?

**一**群人共同開發專案，需要一套規則(workflow)才可以讓大家有效率的開發，如果每個人的習慣不同，很容易產生各種問題，而Git Flow只是其中的一套規則。

## Git Flow 的基本規則

Git Flow有主要的分支有 Master、Develop、Hotfix、Release 以及 Feature 這五種分支，Master、Develop屬於長期分支，其他分支會因任務結束而被刪除。

* Ｍaster: 主要放穩定隨時可上線的版本，此分支只能從別的分支合併過來，開發者不能Commit到這個分支，通常會加上版本號標籤。
* Develop & Feature: Develop是所有開發的基礎分支，當要新增功能的時，新增Feature從此分支出去。而分支的功能完成後，也都會合併回來這個分支。
* Release & Hotfix:  測試階段和修正緊急問題用的分支，目前少機率用到。

![](/files/-M9wjx55zqmLBfOotIkV)

## 操作指南

建立master < ---- 會幫你們弄

再建立branch，並命名為"develop"&#x20;

<figure><img src="/files/obvR9SabAtLG2xLnAJcw" alt=""><figcaption></figcaption></figure>

再建立branch，並命名為"feature/training1"&#x20;

<figure><img src="/files/KsIyjybx2f0KP9OQmRis" alt=""><figcaption></figcaption></figure>

在新的feature分支，開始建立專案或是修改程式碼等等

<figure><img src="/files/n8N5A64gwpP6i5nqm9jn" alt=""><figcaption><p>一旦有小功能完成，請立即 Commit 並且 Push，請不要一大包功能上傳!!!</p></figcaption></figure>

<figure><img src="/files/JhcPnEKMDQCOTwUm6K1H" alt=""><figcaption><p>一旦有小功能完成，請立即 Commit 並且 Push，請不要一大包功能上傳!!!</p></figcaption></figure>

<figure><img src="/files/CxVI9xPWPqwRpkITUNyi" alt=""><figcaption><p>一旦有小功能完成，請立即 Commit 並且 Push，請不要一大包功能上傳!!!</p></figcaption></figure>

一旦feature完成，例如登入頁完成，找關主驗收功能，然後發 Merge Requests

<figure><img src="/files/3BGHOluuLLIsWYDi2KIS" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/OQ7dgHJdEkyV0chEcbUi" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/zl06wuCQHorwN7D0Clla" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cmmobile.gitbook.io/cmmobilebook/git-zhu-ti/git-flow-kai-fa-fang-shi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
