here-be-git
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHere 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 in the current working directory. Confirm to the user that the repository has been initialised.
git init在当前工作目录运行命令。向用户确认仓库已完成初始化。
git initStep 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:
- Check if exists in the current directory
AGENTS.md - If it exists, append the commit instructions to it
- If it doesn't exist, create it with the commit instructions
The commit instructions to add:
markdown
undefined询问用户:
是否需要我添加Agent提交说明,要求Agent在完成任务后始终提交代码?
如果用户确认:
- 检查当前目录是否存在文件
AGENTS.md - 若已存在,将提交说明追加到该文件中
- 若不存在,创建该文件并写入提交说明
需要添加的提交说明如下:
markdown
undefinedGit 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:
- Generate an appropriate based on their input
.gitignore - For common flavours, include standard patterns:
- Node.js: ,
node_modules/,dist/,.env, etc.*.log - Python: ,
__pycache__/,*.pyc,.venv/,venv/,.env, etc.*.egg-info/ - macOS: ,
.DS_Store,.AppleDouble,.LSOverride._* - IDE files: ,
.idea/,.vscode/,*.swp,*.swo*.sublime-*
- Node.js:
- Include any specific files or patterns the user mentions
- Commit the with an appropriate message
.gitignore
If the user declines, skip this step.
询问用户:
是否需要我创建.gitignore文件?如果需要,应包含哪种类型或模式的内容?(例如:Node.js、Python、macOS、IDE文件或特定文件/模式)
如果用户提供了类型或模式:
- 根据用户输入生成对应的文件
.gitignore - 对于常见类型,包含标准模式:
- 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-*
- Node.js:
- 包含用户提到的任何特定文件或模式
- 提交文件并附上合适的提交信息
.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工具进行确认提示
- 保持提交的原子性,且提交信息描述清晰