跳到正文
Skillpedia
部署与云(DevOps)10k · #12001

speckit-git-initialize

它能做什么

这个技能在项目文件夹中启动 Git 仓库,并保存第一批文件。适合开始新项目、希望从一开始就保留版本历史的人员。

适用场景

  • ✓你新建了项目文件夹,想从一开始就用 Git 跟踪的时候。
  • ✓项目文件夹尚未纳入版本控制的时候。
  • ✓你希望用项目文件自动完成首次提交的时候。

技能链接

https://github.com/unoplatform/uno/blob/master/.claude/skills/speckit-git-initialize/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/unoplatform/uno/blob/master/.claude/skills/speckit-git-initialize/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请在这个新项目文件夹中设置 Git,并用当前文件进行首次提交。”

每周 5 个新技能,1 分钟读完。

工作原理

这个技能检查 Git 是否存在,以及该文件夹是否已经是仓库。如果不是,它会启动仓库,添加文件,并进行初始提交。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Initialize Git Repository

Initialize a Git repository in the current project directory if one does not already exist.

Execution

Run the appropriate script from the project root:

  • Bash: .specify/extensions/git/scripts/bash/initialize-repo.sh
  • PowerShell: .specify/extensions/git/scripts/powershell/initialize-repo.ps1

If the extension scripts are not found, fall back to:

  • Bash: git init && git add . && git commit -m "Initial commit from Specify template"
  • PowerShell: git init; git add .; git commit -m "Initial commit from Specify template"

The script handles all checks internally:

  • Skips if Git is not available
  • Skips if already inside a Git repository
  • Runs git init, git add ., and git commit with an initial commit message

Customization

Replace the script to add project-specific Git initialization steps:

  • Custom .gitignore templates
  • Default branch naming (git config init.defaultBranch)
  • Git LFS setup
  • Git hooks installation
  • Commit signing configuration
  • Git Flow initialization

Output

On success:

  • ✓ Git repository initialized

Graceful Degradation

If Git is not installed:

  • Warn the user
  • Skip repository initialization
  • The project continues to function without Git (specs can still be created under specs/)

If Git is installed but git init, git add ., or git commit fails:

  • Surface the error to the user
  • Stop this command rather than continuing with a partially initialized repository
常见问题

如果文件夹已经是仓库会怎样?

这个技能会跳过设置,因此不会更改已有的仓库。

如果没有安装 Git 怎么办?

它会提醒你,并继续执行。项目在没有 Git 的情况下仍然可以运行。

我可以自定义设置吗?

可以。内容指出,可以替换该脚本,添加 .gitignore 模板或签名设置等步骤。

详情

作者的原始描述

Initialize a Git repository with an initial commit

repo: unoplatform/uno

热度

GitHub 星标
10k
排名
#12001
许可证
Apache-2.0
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能