SuperAPI AI Directory

abc-git-flow

Deployment & operations

View repository

Updated 10-15 08:14

About this skill

ABC GIT FLOW Branch Management

ABC customized Git workflow, extended based on git-flow, supporting the gray release process.

Install abc-git-flow

macOS

sudo curl https://cis-static-common.oss-cn-shanghai.aliyuncs.com/assets/abc-git-flow/git-abc-flow-install.sh | sh

If an error occurs Bad CPU type, you need to execute:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

Windows

curl -# -O https://static-common-cdn.abcyun.cn/assets/abc-git-flow/install.bat && call install.bat

Linux

curl https://static-common-cdn.abcyun.cn/assets/abc-git-flow/install-linux.sh | sh

Initialization

For first-time use, execute in the project directory:

git abc init
git abc tag config <前缀>  # 配置 tag 前缀,如 pc、charge

Branch Structure

Long-term branches (direct development prohibited)

Branch Purpose Corresponding Environment
master Stable production code Production environment
gray Gray environment code Gray environment
rc Pre-release testing Pre-release environment
develop Development base branch Testing environment
experience Experience branch, stability not guaranteed Experience environment

Temporary branches

Branch Prefix Source Purpose
feature/* develop New feature development
hotfix/* master Urgent fix for the production environment
hotfix-g/* gray Urgent fix for the gray environment

Branch Naming Conventions: see Branch Naming Rules

Typical Workflows

New Requirement Development

流程:

# 1. 创建 feature 分支
git abc feature start <name>

# 2. 开发完成后,rebase develop(单人开发时)
git fetch origin develop
git rebase origin/develop

# 3. 创建提测 tag (f-tag)
git abc tag create   # 选择 "需求提测(f)"

# 4. 测试通过后,合回 develop
git abc feature finish <name>

Notes:

  • When multiple people collaborate on the same feature, rebase is prohibited; use merge instead
  • After finish, remember to push the develop branch

Production Environment Bug Fix

流程:

# 1. 从 master 创建 hotfix 分支
git abc hotfix start <name>

# 2. 修复后创建测试 tag
git abc tag create   # 选择 "测试环境(t)"

# 3. 测试通过后,合入所有分支
git abc hotfix finish <name>

# 4. 推送所有受影响的分支
git push origin master gray rc develop

# 5. 删除 hotfix 分支
git branch -d hotfix/<name>
git push origin --delete hotfix/<name>

Key Reminders: hotfix finish will automatically merge into the four branches master, gray, rc, and develop. Be sure to push all of them!

Gray Environment Bug Fix

流程:

# 1. 从 gray 创建 hotfix-g 分支
git abc hotfix-g start <name>

# 2. 修复后创建测试 tag
git abc tag create   # 选择 "测试环境(t)"

# 3. 测试通过后,合入相关分支
git abc hotfix-g finish <name>

# 4. 推送所有受影响的分支
git push origin gray rc develop

# 5. 删除 hotfix-g 分支
git branch -d hotfix-g/<name>
git push origin --delete hotfix-g/<name>

Key Reminders: hotfix-g finish will merge into the three branches gray, rc, and develop (excluding master)

Release Process

Integration testing (t-tag):

# 在 develop 分支打 t-tag
git checkout develop
git abc tag create   # 选择 "测试环境(t)"

Release to pre-release (p-tag):

# 将 develop 合入 rc
git abc rc start

# 打预发布 tag
git abc tag create   # 选择 "预发布环境(p)"
git push origin rc

Release to gray (g-tag):

# 将 rc 合入 gray
git abc rc finish
git push origin gray

# 打灰度 tag
git checkout gray
git abc tag create   # 选择 "灰度环境(g)"

Release to full rollout (v-tag):

# 将 gray 合入 master
git abc gray publish
git push origin master

# 打全量 tag
git checkout master
git abc tag create   # 选择 "正式环境(v)"

Tag Naming Conventions

Tags created interactively via git abc tag create automatically conform to the conventions.

Format: 前缀年份.周数.构建号

Prefix Purpose Example
xxx-f feature function submitted for testing pc-f2021.09.01
xxx-t Integration testing pc-t2021.09.02
xxx-p Pre-release pc-p2021.09.01
xxx-g Gray release pc-g2021.09.01
xxx-v Official release pc-v2021.09.01

Detailed Description: see Detailed Tag Creation Guide, which includes complete instructions on tag types, branch constraints, onboarding/testing information, etc.

Rebase Usage Principles

Scenarios where rebase is recommended:

  • For independently developed feature branches, merge in the latest develop code
  • For independently developed hotfix branches, merge in the latest master code
  • Sync local branch with remote: git pull --rebase

Scenarios where rebase is prohibited:

  • Multi-person collaborative branches (can cause history confusion)

Merge Request Management

# 创建 MR(交互式选择目标分支和评审者)
git abc mr create

# 配置云效 Token
git abc mr config

Non-interactive scripts

git abc Some commands (such as tag create, mr create) require interactive input, which is inconvenient to use in automation scenarios (CI/CD, script batch processing, IDE integration, etc.). Python scripts are provided as non-interactive alternatives.

Install dependencies:

pip install requests

Tag creation script (scripts/tag_create.py)

# 创建正式环境 tag
scripts/tag_create.py v --deps "abc-auth" --operation "无"

# 创建需求提测 tag
scripts/tag_create.py f \
  --deps "无" \
  --operation "无" \
  --remark "feat: 实现新功能" \
  --tapd-id "1122044681001112866"

# 创建灰度环境 tag
scripts/tag_create.py g --deps "abc-auth" --operation "无"

# 仅创建 tag,跳过上车/提测
scripts/tag_create.py v --skipdeploy

Parameter description:

Parameter Description Required
tag_type Tag type (f/t/v/g/p) Yes
--deps Dependent services Required when onboarding/submitting for testing
--operation Required operations Required when onboarding/submitting for testing
--remark Remarks/description Required when submitting for testing
--tapd-id Associated TAPD ID No (optional for f tag)
-b, --business Business line (default abc-his) No
--prefix Tag prefix (read from git config by default) No
--hotfix Hotfix mode No
--skipdeploy Skip onboarding/submitting for testing, only create tag No

MR creation script (scripts/mr_create.py)

# 创建 MR
scripts/mr_create.py \
  -t develop \
  -T "feat: 新功能开发" \
  -r 张三 李四

# 指定描述
scripts/mr_create.py \
  -t develop \
  -T "fix: 修复bug" \
  -r 张三 \
  -d "修复了xxx问题"

# 跳过企业微信通知
scripts/mr_create.py \
  -t develop \
  -T "feat: xxx" \
  -r 张三 \
  --skip-notify

Parameter description:

Parameter Description Required
-t, --target Target branch Yes
-T, --title MR title Yes
-r, --reviewers Reviewer names (separate multiple with spaces) Yes
-d, --description MR description No
--skip-notify Skip WeCom notification No

Prerequisites: MR creation requires configuring the Yunxiao Token first, run git abc mr config or manually create ~/.abc-fed-config/mr.json。

Command quick reference

# 初始化仓库
git abc init

# Feature 管理
git abc feature start <name>     # 从 develop 创建
git abc feature finish <name>    # 合回 develop

# Hotfix 管理(正式环境)
git abc hotfix start <name>      # 从 master 创建
git abc hotfix finish <name>     # 合入 master/gray/rc/develop

# Hotfix-g 管理(灰度环境)
git abc hotfix-g start <name>    # 从 gray 创建
git abc hotfix-g finish <name>   # 合入 gray/rc/develop

# RC 管理
git abc rc start                 # develop → rc
git abc rc finish                # rc → gray

# Gray 管理
git abc gray publish             # gray → master

# Tag 管理
git abc tag create               # 交互式创建 tag
git abc tag create <类型>        # 直接指定 tag 类型 (v/g/p/f/t)
git abc tag show [类型]          # 查看最近 tag
git abc tag config [前缀]        # 配置 tag 前缀

# MR 管理
git abc mr create                # 创建 Merge Request
git abc mr config                # 配置云效 Token

# 其他
git abc -v                       # 查看版本
git abc -h                       # 查看帮助
git abc update                   # 更新工具

Command support comparison

Operation Interactive command Non-interactive script Recommended method
Feature operations git abc feature start/finish - Interactive
Hotfix operations git abc hotfix start/finish - Interactive
RC operations git abc rc start/finish - Interactive
Tag configuration git abc tag config <前缀> - Interactive
Tag creation git abc tag create [类型] tag_create.py [类型] --deps xxx Use non-interactive in automation scenarios
MR creation git abc mr create mr_create.py -t xxx -T xxx -r xxx Use non-interactive in automation scenarios

Tip: In non-interactive terminal environments (CI/CD, script batch processing, IDE integration, etc.), prioritize using non-interactive scripts to create Tags and MRs to avoid terminal blocking.

Operation guiding principles

  1. Confirm before execution: Before executing the git abc command, first use git status to confirm the workspace is clean
  2. Push promptly: After the finish operation, immediately push all affected branches
  3. Clean up branches: After merging is complete, delete obsolete temporary branches
  4. Conflict handling: When encountering merge conflicts, resolve them carefully before continuing
  5. Observe prompts: Pay attention to prompt messages during command execution and follow the prompts