push

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Git Push Skill

Git Push 技能

Automates Git workflow to save your notes with meaningful commit messages and push to remote repository.
自动化Git工作流,使用有意义的提交信息保存笔记并推送到远程仓库。

Usage

使用方法

Invoke with
/push
or ask Claude to save/commit your changes.
通过
/push
指令调用,或让Claude保存/提交你的变更。

Basic Usage

基础用法

/push
/push

With Custom Message

自定义提交信息

/push "Completed project planning"
/push "完成项目规划"

What This Skill Does

该技能的功能

  1. Stages All Changes
    • Adds all modified files
    • Includes new files
    • Removes deleted files
  2. Creates Smart Commit Message
    • Uses provided message, or
    • Auto-generates from changes
    • Includes date/time stamp
    • Summarizes key modifications
  3. Syncs with Remote
    • Pulls latest changes (if enabled)
    • Pushes to remote repository
    • Handles merge conflicts gracefully
  1. 暂存所有变更
    • 添加所有已修改文件
    • 包含新增文件
    • 移除已删除文件
  2. 生成智能提交信息
    • 使用提供的自定义信息,或
    • 根据变更自动生成
    • 包含日期/时间戳
    • 总结关键修改内容
  3. 与远程仓库同步
    • 拉取最新变更(若启用)
    • 推送到远程仓库
    • 优雅处理合并冲突

Commit Message Format

提交信息格式

Automatic Messages

自动生成的信息

Based on your changes:
Daily note for 2024-01-15 + 3 project updates
- Added: Daily Notes/2024-01-15.md
- Modified: Projects/Learning Spanish/notes.md
- Modified: Goals/2. Monthly Goals.md
基于你的变更内容:
Daily note for 2024-01-15 + 3 project updates
- Added: Daily Notes/2024-01-15.md
- Modified: Projects/Learning Spanish/notes.md
- Modified: Goals/2. Monthly Goals.md

With Timestamp

带时间戳的格式

[2024-01-15 09:30] Completed weekly review
[2024-01-15 09:30] Completed weekly review

Workflow Integration

工作流集成

Morning Routine

晨间流程

/daily          # Create daily note
/daily          # 创建每日笔记

... work on notes ...

... 编辑笔记 ...

/push "Morning planning complete"
undefined
/push "晨间规划完成"
undefined

End of Day

每日收尾

undefined
undefined

Complete daily reflection

完成每日复盘

/push # Auto-message with summary
undefined
/push # 自动生成包含总结的提交信息
undefined

After Weekly Review

周复盘后

/weekly         # Run weekly review
/push "Weekly review - Week 3"
/weekly         # 执行周复盘
/push "周复盘 - 第3周"

Git Operations

Git操作流程

Standard Flow

标准流程

  1. git add .
    - Stage all changes
  2. git commit -m "message"
    - Create commit
  3. git pull --rebase origin main
    - Get remote changes
  4. git push origin main
    - Push to remote
  1. git add .
    - 暂存所有变更
  2. git commit -m "message"
    - 创建提交
  3. git pull --rebase origin main
    - 获取远程变更
  4. git push origin main
    - 推送到远程

Safety Checks

安全检查

  • Verify Git repository exists
  • Check for uncommitted changes
  • Ensure remote is configured
  • Validate branch exists
  • 验证Git仓库是否存在
  • 检查是否有未提交的变更
  • 确保已配置远程仓库
  • 验证分支是否存在

Conflict Handling

冲突处理

If conflicts occur:
  1. Auto-resolve attempts (favor local for notes)
  2. If manual resolution needed, guide through process
  3. Never force push without explicit request
若发生冲突:
  1. 尝试自动解决(笔记类文件优先保留本地版本)
  2. 若需要手动解决,将引导你完成流程
  3. 未经明确请求,绝不会强制推送

Security Considerations

安全注意事项

Never Commit

切勿提交

  • Passwords or credentials
  • API keys
  • Personal identification
  • Financial information
  • 密码或凭证
  • API密钥
  • 个人身份信息
  • 财务信息

Use .gitignore for

建议加入.gitignore的内容

private/
credentials.md
.env
.obsidian/workspace*
.obsidian/cache
.trash/
.DS_Store
private/
credentials.md
.env
.obsidian/workspace*
.obsidian/cache
.trash/
.DS_Store

Troubleshooting

故障排查

Push Rejected?

推送被拒绝?

Pull first, then push again:
bash
git pull --rebase origin main
git push origin main
先拉取远程变更,再重新推送:
bash
git pull --rebase origin main
git push origin main

Not a Git Repository?

不是Git仓库?

bash
git init
git remote add origin [URL]
bash
git init
git remote add origin [URL]

Large Files Issue?

大文件问题?

Consider Git LFS for images/attachments.
可考虑使用Git LFS处理图片/附件。

Integration

集成兼容性

Works with:
  • /daily
    - Commit after creating daily note
  • /weekly
    - Commit after weekly review
  • /onboard
    - No git needed for context loading
  • Auto-commit hook for automatic saves
可与以下功能配合使用:
  • /daily
    - 创建每日笔记后提交
  • /weekly
    - 完成周复盘后提交
  • /onboard
    - 加载上下文无需Git
  • 自动提交钩子实现自动保存