git

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Git

Git

Use
git
to inspect history, create branches, commit changes, and resolve conflicts.
使用
git
查看历史记录、创建分支、提交更改以及解决冲突。

Common workflows

常见工作流程

  • Check status:
    git status
  • Create a branch:
    git checkout -b my-branch
  • Stage + commit:
    git add -A && git commit -m "message"
  • Rebase:
    git rebase -i origin/main
  • 查看状态:
    git status
  • 创建分支:
    git checkout -b my-branch
  • 暂存并提交:
    git add -A && git commit -m "message"
  • 变基:
    git rebase -i origin/main

GitHub Integration

GitHub集成

After making local commits with git, use the GitHub tools to push your work upstream and open pull requests:
  • Create a remote branch — Use
    github_branch_create
    to create a branch on the remote from a given SHA. Get the SHA from your local HEAD with
    git rev-parse HEAD
    , then create the matching remote branch.
  • Open a pull request — Use
    github_pr_create
    to open a PR from your feature branch to the default branch, with a clear title and description summarizing the changes.
  • Full GitHub API operations — The
    github
    skill provides 26 tools covering PR review, merge, issue triage, release management, Actions CI/CD, and more. Reference it for anything beyond local git operations.
Division of responsibility: Use
git
for local operations (staging, committing, branching, rebasing, diffing, log inspection) and the
github_*
tools for remote API operations (creating PRs, reviewing code, managing issues, triggering workflows). The two complement each other — git handles your local working copy while the GitHub tools interact with the hosted platform.
使用git完成本地提交后,可借助GitHub工具将工作推送到上游仓库并发起拉取请求:
  • 创建远程分支 — 使用
    github_branch_create
    从指定SHA在远程端创建分支。通过
    git rev-parse HEAD
    获取本地HEAD的SHA,然后创建对应的远程分支。
  • 发起拉取请求 — 使用
    github_pr_create
    从功能分支向默认分支发起PR,附上清晰的标题和描述以总结变更内容。
  • 完整GitHub API操作
    github
    技能提供26种工具,涵盖PR评审、合并、问题分类、发布管理、Actions CI/CD等功能。超出本地git操作的需求均可参考该技能。
职责划分: 使用
git
进行本地操作(暂存、提交、分支创建、变基、差异对比、日志查看),使用
github_*
工具进行远程API操作(创建PR、代码评审、问题管理、触发工作流)。两者相辅相成——git处理本地工作副本,GitHub工具则与托管平台交互。