here-be-git

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Here Be Git

Here Be Git

Initialise a git repository with optional configuration for agent workflows.
初始化Git仓库,可选择配置Agent工作流相关设置。

Workflow

工作流程

Step 1: Initialise Git Repository

步骤1:初始化Git仓库

Run
git init
in the current working directory. Confirm to the user that the repository has been initialised.
在当前工作目录运行
git init
命令。向用户确认仓库已完成初始化。

Step 2: Agent Commit Instructions

步骤2:Agent提交说明

Ask the user:
Would you like me to add instructions for the agent to always commit when it's done with a task?
If the user confirms:
  1. Check if
    AGENTS.md
    exists in the current directory
  2. If it exists, append the commit instructions to it
  3. If it doesn't exist, create it with the commit instructions
The commit instructions to add:
markdown
undefined
询问用户:
是否需要我添加Agent提交说明,要求Agent在完成任务后始终提交代码?
如果用户确认:
  1. 检查当前目录是否存在
    AGENTS.md
    文件
  2. 若已存在,将提交说明追加到该文件中
  3. 若不存在,创建该文件并写入提交说明
需要添加的提交说明如下:
markdown
undefined

Git Workflow

Git工作流

  • Always commit your changes when you have completed a task or reached a logical stopping point
  • Use clear, descriptive commit messages that explain what was done and why
  • Ensure the working directory is clean (all changes committed) before ending your session

After creating or updating `AGENTS.md`:

1. Check if `CLAUDE.md` exists in the current directory
2. If it doesn't exist, create it with just `@AGENTS.md` followed by a newline
3. If it exists but doesn't already have `@AGENTS.md` at the top, prepend `@AGENTS.md` followed by a newline to the existing content
4. Commit both files together with an appropriate message
  • 完成任务或到达合理的停顿点时,务必提交所有更改
  • 使用清晰、具有描述性的提交信息,说明完成的工作及原因
  • 结束会话前,确保工作目录干净(所有更改已提交)

创建或更新`AGENTS.md`后:

1. 检查当前目录是否存在`CLAUDE.md`文件
2. 若不存在,创建该文件并仅写入`@AGENTS.md`及换行符
3. 若已存在但顶部没有`@AGENTS.md`,则在现有内容前添加`@AGENTS.md`及换行符
4. 将两个文件一起提交,并附上合适的提交信息

Step 3: Gitignore Configuration

步骤3:.gitignore配置

Ask the user:
Would you like me to create a .gitignore? If so, what flavour or patterns should I include? (e.g., Node.js, Python, macOS, IDE files, or specific files/patterns)
If the user provides a flavour or patterns:
  1. Generate an appropriate
    .gitignore
    based on their input
  2. For common flavours, include standard patterns:
    • Node.js:
      node_modules/
      ,
      dist/
      ,
      .env
      ,
      *.log
      , etc.
    • Python:
      __pycache__/
      ,
      *.pyc
      ,
      .venv/
      ,
      venv/
      ,
      .env
      ,
      *.egg-info/
      , etc.
    • macOS:
      .DS_Store
      ,
      .AppleDouble
      ,
      .LSOverride
      ,
      ._*
    • IDE files:
      .idea/
      ,
      .vscode/
      ,
      *.swp
      ,
      *.swo
      ,
      *.sublime-*
  3. Include any specific files or patterns the user mentions
  4. Commit the
    .gitignore
    with an appropriate message
If the user declines, skip this step.
询问用户:
是否需要我创建.gitignore文件?如果需要,应包含哪种类型或模式的内容?(例如:Node.js、Python、macOS、IDE文件或特定文件/模式)
如果用户提供了类型或模式:
  1. 根据用户输入生成对应的
    .gitignore
    文件
  2. 对于常见类型,包含标准模式:
    • Node.js
      node_modules/
      ,
      dist/
      ,
      .env
      ,
      *.log
    • Python
      __pycache__/
      ,
      *.pyc
      ,
      .venv/
      ,
      venv/
      ,
      .env
      ,
      *.egg-info/
    • macOS
      .DS_Store
      ,
      .AppleDouble
      ,
      .LSOverride
      ,
      ._*
    • IDE文件
      .idea/
      ,
      .vscode/
      ,
      *.swp
      ,
      *.swo
      ,
      *.sublime-*
  3. 包含用户提到的任何特定文件或模式
  4. 提交
    .gitignore
    文件并附上合适的提交信息
如果用户拒绝,跳过此步骤。

Notes

注意事项

  • If git is already initialised in the directory, inform the user and skip to Step 2
  • Use the AskUserQuestion tool for the confirmation prompts
  • Keep commits atomic and well-described
  • 若目录中已初始化Git,告知用户并直接跳至步骤2
  • 使用AskUserQuestion工具进行确认提示
  • 保持提交的原子性,且提交信息描述清晰