agentleFS
kiko197kiko197/skill/git-workflow/SKILL.md

git-workflow

Skill0 starsChanged 3 months agoMITView on GitHub

规范化、可追溯的 Git 工作流。当需要创建功能分支、编写规范的提交信息、整理/清理提交历史、平滑 rebase 或合并、解决冲突、回滚错误提交,或在团队协作中保持 git 历史清晰可读时使用。

  • Commits and pushes

188 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use squad-commands, ci-cd-pipelines and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Microsoft AzureSkill

    squad-commands

    Categorized catalog of common Squad operations. Coordinator reads this file and presents it as an interactive menu when the user asks for available commands or help.

    Also in 5 projects that use this

  • harrissohail6Skill

    ci-cd-pipelines

    CI/CD pipeline design and implementation. Auto-activates when discussing deployment, automation, or pipelines.

    Also in 6 projects that use this

  • Microsoft AzureSkill

    architectural-proposals

    How to write comprehensive architectural proposals that drive alignment before code is written

    Also in 4 projects that use this

  • GitHubSkill

    e2e-template-testing

    End-to-end validation of coordinator and agent template changes

    Also in 3 projects that use this

  • GitHubSkill

    notification-routing

    Route agent notifications to specific channels by type — prevent alert fatigue from single-channel flooding

    Also in 3 projects that use this

  • frostneySkill

    native-nostalgia-stack

    Applies the user's FreePascal toolchain and its build, formatting, hook, and test contracts while leaving project-specific mechanics local. Use when scaffolding or working in a FreePascal project that follows this toolchain.

    Also in 3 projects that use this

  • +5 more from Azure
  • +1 more from github

The file

Files
SKILL.md

Git 工作流

一套可复用的 Git 操作规范与常用命令,用于保证提交历史清晰、可追溯、可回滚。

何时使用

  • 开始一个新功能 / 修复 / 重构任务时建立分支。
  • 需要写规范、有条理的一连串提交。
  • 提交历史凌乱需要整理(rebase -i / squash)。
  • 需要将分支合并回主干,或回滚错误的提交。
  • 处理 merge/rebase 冲突。

核心流程

1. 开始前:确认基线

git status                     # 确认工作区干净
git fetch origin --prune       # 同步远端并清理已删除分支的引用
git log --oneline -5           # 确认起点

2. 创建特性分支

# 分支命名:type/描述,例如 feat/, fix/, refactor/, docs/, chore/
git switch -c feat/login-page origin/main

3. 编写规范提交(Conventional Commits)

<type>(<scope>): <subject>

<body: 为什么做、怎么解决、影响范围>

<footer: 关闭的 issue、破坏性变更说明>

常用类型:feat fix refactor docs test chore perf style revert。

git add -A
git commit -m "feat(login): 支持手机号+验证码登录"

一条提交只做一件事:单一职责。避免把无关改动混进一个 commit。

4. 不要直接 rebase 已推送到远端的共享分支

只对尚未推送/只有你自己在用的本地提交做历史整理。

5. 提交历史整理(仅限本地/未推送提交)

# 交互式整理最近 3 条提交:s=合并、r=改写消息、e=编辑
git rebase -i HEAD~3

# 将最近 N 条且未推送的提交压成一条(示例 3 条)
git reset --soft HEAD~3
git commit -m "feat(x): 合并后的完整说明"

6. 合并回主干

git switch main && git pull --rebase origin main
git switch feat/login-page
# 优先用 rebase 使历史线性,再 fast-forward
git rebase main
git switch main
git merge --ff-only feat/login-page
git push

7. 冲突处理

不要 commit 手动冲突标记。逐个文件解决后:

git add <resolved-file>
git rebase --continue   # 或 git merge --continue
git rebase --abort      # 搞乱时安全退出

8. 回滚

# 撤销最近一次提交(保留工作区改动)
git reset --soft HEAD~1
# 撤销已推送的错误提交(产生一个新的“撤销”提交,安全用于共享分支)
git revert <commit>

质量检查清单

  • 分支名清晰,且只做一件事。
  • 提交信息遵循 Conventional Commits。
  • 每个 commit 通过构建/测试。
  • 未把无关改动混入同一 commit。
  • 未改写已推送的共享历史。
  • 合并采用 --ff-only 或显式说明为何需要 merge commit。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.