國家表演藝術中心國家兩廳院資通安全管理制度
歡迎來到我們的資通安全制度網站,我們深知在數位化時代,資訊安全的重要性日益提升,我們致力於建立一個安全、可信賴的營運環境。
版本管理流程(試行)
2025-04-30
版本管理流程(試行)
專案管理流程
常見版本管理流程
1.傳統Flow(cvs like)
gitGraph commit commit commit id: "Alpha" tag: "v1.0.0-alpha" commit commit id: "Beta" tag: "v1.0.0-beta" commit commit id: "Release 1.0.0" tag: "v1.0.0" commit branch hotfix commit checkout main commit merge hotfix id:"Release 1.0.1" tag: "v1.0.1" commit
2.GitFlow
gitGraph
commit
branch hotfix
checkout hotfix
commit
branch develop
checkout develop
commit id:"ash" tag:"abc"
branch featureB
checkout featureB
commit type:HIGHLIGHT
checkout main
checkout hotfix
commit type:NORMAL
checkout develop
commit type:REVERSE
checkout featureB
commit
checkout main
merge hotfix
checkout featureB
commit
checkout develop
branch featureA
commit
checkout develop
merge hotfix
checkout featureA
commit
checkout featureB
commit
checkout develop
merge featureA
branch release
checkout release
commit
checkout main
commit
checkout release
merge main
checkout develop
merge release
3.GitHub Flow
gitGraph
commit id: "Release 1.0.0" tag: "v1.0.0"
branch "feature/issue#1"
commit
checkout main
merge "feature/issue#1"
commit id: "Release 1.1.0" tag: "v1.1.0"
branch "feature/issue#2"
commit
checkout main
merge "feature/issue#2"
commit id: "Release 1.2.0" tag: "v1.2.0"
branch "bugfix/issue#3"
commit
checkout main
merge "bugfix/issue#3"
commit id: "Release 1.2.1" tag: "v1.2.1"
版本管理試行情境:
發現一個 Bug 或需要新增一個功能,並指派給特定開發者處理。( 使用GitHub Flow )
版本管理試行情境流程
sequenceDiagram
actor A as PM
participant B as GitHub
actor C as Dev
participant D as Git
A->>B: 1.建立工作( New issue )
B->>C: 2.指派人員 ( Assignee )
C->>D: 3.建立分支 ( Create Branch )
D->>B: 4.送出 PR ( Pull Request )
B->>A: 5.審核 PR
A->>B: 6.核准 PR,刪除分支
C->>D: 7.刪除分支
1.建立 Issue:
- 這是工作的起點,明確記錄需要完成的任務。
- 操作: 打開 GitHub 上的專案倉庫頁面。點擊上方的 Issues 標籤 -> 點擊 New issue 按鈕。
- 內容: 填寫清晰的標題 (Title) 和詳細的描述 (Description)。
- 專案負責人(PM) 指派人員 (Assignee):
- 在建立 Issue 的頁面右側,找到 Assignees (指派人員) 區塊。
- 點擊齒輪圖標或連結 -> 從列表中選擇負責這個 Issue 的開發者。
2.開發者接收 Issue、建立分支並進行開發 (由被指派的開發者執行)
- 接收並理解 Issue:
- 打開被指派的 Issue 頁面,詳細閱讀標題和描述,確保完全理解任務需求。
- 更新本地倉庫並建立新的工作分支:
- 分支的命名建議
- [type]/[issue#id]-[description]
- 例: bugfix/issus#123
- type
- feature/: 開發新功能。例如:feature/issue#id
- bugfix/: 修復 Bug。例如:bugfix/issue#id
- hotfix/: 緊急修復生產環境 Bug。通常直接從主分支分出。例如:hotfix/issue#id
- release/: 準備釋出新版本。例如:release/issue#id
- chore/: 不屬於前面類型的維護性或雜項工作。例如:chore/issue#id
- docs/: 文件相關修改。例如:docs/issue#id
- refactor/: 程式碼重構。例如:refactor/issue#id
- 分支的命名建議
sh
# 確保在本地主分支 (通常是 main 或 master)
git checkout main
# 拉取遠端最新變更
git pull origin main
# 建立一個新的分支來處理這個 Issue
# 分支名稱建議包含 Issue 號碼,便於追蹤
git checkout -b bugfix/issus#123
3.完成修改提交,送出PR(Pull Request)
- 完成修改,送出PR
- 暫存並提交修改
sh
git add .
# 7.Git Commit 規範規則
git commit -m "bugfix: issus#123\n\n 完成issue 123 修改\n\n Closes #123"
# 或 單行解釋( 網頁issue為主 )
git commit -m "bugfix: issus#123"
- 將本地分支推送到遠端倉庫
sh
# 第一次使用,建立遠端分支
# git push -u origin [your-branch-name]
# 更新遠端分支
# git push origin [your-branch-name]
git push -u origin bugfix/issus#123
# 或
git push origin bugfix/issus#123
4.進入 GitHub 發起 Pull Request (PR)
- 發起
- 網頁進入倉庫的 Pull requests 標籤頁 -> 點擊 New pull request 按鈕。
- 選擇要原始倉庫的 main 和 新分支(bugfix/issus#123)
- 填寫 Pull Request 的標題 (Title) 和描述 (Description)
- 右側的 “Development” 區塊手動連結 Issue
- 點擊 Create pull request 按鈕
5.核准 PR 後,關閉Issue,刪除分支
sh
# 切換到主要分支
git checkout main
# 刪除本地分支
git branch -d bugfix/issus#123
# 刪除遠端分支
git push origin --delete bugfix/issus#123
6.訂立版本編號(Option)
7.Git Commit 規範規則(Option)
Commit 撰寫參考: 慣例式提交
text
[type]: [簡述]
[(option)較為具體的簡述]
[issue#123]
4.A.使用本地檢查 Pull Request (PR)
- 本地檢查程式碼
sh
# 回到主要分支並且更新
git checkout main
git pull origin main
# 拉取該 Pull Request 分支的程式碼
# git fetch origin pull/<PR_NUMBER>/head:<local-branch-name>
git fetch origin pull/123/head:pr#123
# 切換到 Pull Request 分支
git checkout bugfix/issus#123
# 完成本地檢查後,切換回原來的分支
git checkout main
# 清理本地的 Pull Request 分支
git branch -D bugfix/issus#123