> For the complete documentation index, see [llms.txt](https://developer.cscmobicorp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.cscmobicorp.com/quy-trinh-git.md).

# Quy trình Git

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

## 1. Các Branch và ý nghĩa

* **Main (Master):** là nhánh sẽ tương ứng với bản game trên store.
  * Trường hợp nếu các platform khác nhau thì có thể đặt: **main-xxxx**&#x20;
  * Ví dụ: main-android, main-ios, main-webgl
* **dev:** là nhánh sẽ dùng để merge các tính năng và dùng để build ra bản test. Nhánh dev được base từ nhánh Main
* **dev-xxxx**: là nhánh dùng để dev các tính năng, nhánh này được base từ nhánh dev
* **fix-xxx:** là nhánh dùng để fix các lỗi từ nhánh **Main**, tương ứng với bản trên store. Nhánh này được base từ nhánh **Main**

## 2. Quy trình sử dụng

### 2.1 Khởi tạo các branch

Dùng lệnh sau để tạo 1 nhánh mới base từ nhánh gốc

```
git checkout -b <tên nhánh mới> [nhánh gốc]
```

* Nhánh Main được tạo ngay từ đầu project
* Nhánh dev được base từ nhánh Main
* Khi phát triển tính năng nào thì base từ nhánh dev
  * Ví dụ tính năng login thì tạo nhánh dev-login
* Khi bản trên store có lỗi và cần fix thì sẽ tạo nhánh fix-xxxx (trong đó xxxx là tên ngắn gọn mô tả fix cái gì). Nhánh này base trên nhánh Main
  * ví dụ tính năng login có lỗi và cần sửa thì tạo nhánh fix-login base từ nhánh main

### 2.2 Quy trình sử dụng

<figure><img src="/files/7uJDzEMWzU68bUWidB8Y" alt=""><figcaption><p>Quy trình sử dụng Git</p></figcaption></figure>

* Các nhánh tính năng **dev-xxxx** phải luôn được pull từ nhánh **Main** để đảm bảo được update code mới nhất từ nhánh **Main**.
* Sau khi tính năng được làm xong thì thì merge nhánh **dev-xxxx** vào nhánh **dev** và đem build test sản phẩm
* Khi sản phẩm đã test thành công, thì merge nhánh từ nhánh **dev** vào nhánh **Main** và build sản phẩm để đưa lên store
* Nếu bản trên store, tương ứng với code mới nhất ở nhánh Main có lỗi, thì tạo nhánh **fix-xxxx** để sửa lỗi. Sau khi sửa xong thì merge vào nhánh **Main** để build sản phẩm và đưa lại lên store.
* Sau khi fix lỗi xong thì các nhánh **dev-xxxx** cần được merge từ nhánh **Main** để đảm bảo việc fix lỗi đã được đưa vào source code.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://developer.cscmobicorp.com/quy-trinh-git.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.
