Test commit with Claude Code summary

This commit is contained in:
linbin 2025-08-14 18:24:39 +08:00
parent c4b9de3044
commit 561570b11b
3 changed files with 400 additions and 9 deletions

91
CLAUDE_GIT_INTEGRATION.md Normal file
View File

@ -0,0 +1,91 @@
# Claude Code Git Integration
This document explains how to use the custom git commands created for Claude Code to summarize file changes and commit them with proper attribution.
## Installation
The custom git command has been installed in your system with the following components:
1. A `git-claude` script in `~/bin/` directory
2. A git alias `claude` that points to the script
3. A git hook that automatically summarizes changes in commit messages
## Usage
### 1. Summarize Changes
To get a summary of current changes in your repository:
```bash
git claude summarize
```
This command will show:
- Staged changes (files ready to be committed)
- Unstaged changes (modified files not yet staged)
- Untracked files (new files not yet added to git)
### 2. Commit with Claude Signature
To commit changes with the proper Claude Code signature:
```bash
git claude commit "Your commit message here"
```
This command will:
- Stage all changes if none are currently staged
- Create a commit with your message
- Automatically add the Claude Code signature:
```
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
```
### 3. Using Standard Git Commands
You can also use standard git commands which will now include Claude Code summaries:
```bash
# Standard git add and commit
git add .
git commit -m "Your message"
# The prepare-commit-msg hook will automatically add a summary
```
## How It Works
1. **Git Hook**: The `prepare-commit-msg` hook in `.git/hooks/` automatically adds a summary of changes to your commit messages.
2. **Custom Command**: The `git-claude` script provides a convenient interface for common Claude Code workflows.
3. **Git Alias**: The `git claude` alias allows you to use `git claude` instead of `git-claude`.
## Examples
```bash
# Get a summary of current changes
git claude summarize
# Commit changes with a custom message
git claude commit "Add new user authentication feature"
# Commit changes with default message
git claude commit
```
## Troubleshooting
If you encounter any issues:
1. Make sure the `~/bin/` directory is in your PATH
2. Verify the script is executable: `chmod +x ~/bin/git-claude`
3. Check that the git alias is properly configured: `git config --get-regexp alias.claude`
## Customization
You can customize the behavior by modifying the scripts in:
- `~/bin/git-claude` - Main script
- `.git/hooks/prepare-commit-msg` - Commit message hook

View File

@ -176,6 +176,99 @@
color: #c82333; color: #c82333;
} }
.switch {
position: relative;
display: inline-block;
width: 44px;
height: 24px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
border-radius: 24px;
}
.slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(20px);
-ms-transform: translateX(20px);
transform: translateX(20px);
}
.tabs {
margin-bottom: 20px;
}
.tab-buttons {
display: flex;
border-bottom: 1px dashed #ccc;
background-color: #fafafa;
}
.tab-button {
padding: 12px 24px;
background: none;
border: none;
border-bottom: 2px solid transparent;
cursor: pointer;
font-size: 14px;
color: #666;
transition: all 0.2s;
}
.tab-button:hover {
color: #333;
background-color: #f0f0f0;
}
.tab-button.active {
color: #007bff;
border-bottom-color: #007bff;
background-color: white;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
@media (max-width: 768px) { @media (max-width: 768px) {
.search-row { .search-row {
flex-direction: column; flex-direction: column;
@ -201,7 +294,15 @@
<div class="container"> <div class="container">
<div class="page-title">积分商城</div> <div class="page-title">积分商城</div>
<div class="search-section"> <div class="tabs">
<div class="tab-buttons">
<button class="tab-button active" onclick="switchTab(event, 'points-discount')">积分优惠</button>
<button class="tab-button" onclick="switchTab(event, 'double-points')">双倍积分</button>
</div>
</div>
<div id="points-discount" class="tab-content active">
<div class="search-section">
<div class="search-row"> <div class="search-row">
<div class="form-group"> <div class="form-group">
<label>商铺:</label> <label>商铺:</label>
@ -242,9 +343,11 @@
<th width="150">规格名称</th> <th width="150">规格名称</th>
<th width="150">归属店铺</th> <th width="150">归属店铺</th>
<th width="100">商品原价</th> <th width="100">商品原价</th>
<th width="120">原有商品状态</th>
<th width="120">积分使用模式</th> <th width="120">积分使用模式</th>
<th width="120">剩余库存</th> <th width="120">剩余库存</th>
<th width="120">操作</th> <th width="100">启用状态</th>
<th width="100">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -257,12 +360,18 @@
<td>小份</td> <td>小份</td>
<td>生生蔬菜店</td> <td>生生蔬菜店</td>
<td>¥5.00</td> <td>¥5.00</td>
<td>上架</td>
<td>积分换购</td> <td>积分换购</td>
<td>10</td> <td>10</td>
<td>
<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</td>
<td> <td>
<div class="action-buttons"> <div class="action-buttons">
<button class="btn-edit">编辑</button> <button class="btn-edit">编辑</button>
<button class="btn-delete">删除</button>
</div> </div>
</td> </td>
</tr> </tr>
@ -275,12 +384,18 @@
<td>大份</td> <td>大份</td>
<td>生生蔬菜店</td> <td>生生蔬菜店</td>
<td>¥8.00</td> <td>¥8.00</td>
<td>上架</td>
<td>积分优惠购</td> <td>积分优惠购</td>
<td>10</td> <td>10</td>
<td>
<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</td>
<td> <td>
<div class="action-buttons"> <div class="action-buttons">
<button class="btn-edit">编辑</button> <button class="btn-edit">编辑</button>
<button class="btn-delete">删除</button>
</div> </div>
</td> </td>
</tr> </tr>
@ -293,12 +408,18 @@
<td></td> <td></td>
<td>生生蔬菜店</td> <td>生生蔬菜店</td>
<td>¥3.50</td> <td>¥3.50</td>
<td>下架</td>
<td>积分换购</td> <td>积分换购</td>
<td>2</td> <td>2</td>
<td>
<label class="switch">
<input type="checkbox">
<span class="slider"></span>
</label>
</td>
<td> <td>
<div class="action-buttons"> <div class="action-buttons">
<button class="btn-edit">编辑</button> <button class="btn-edit">编辑</button>
<button class="btn-delete">删除</button>
</div> </div>
</td> </td>
</tr> </tr>
@ -311,12 +432,18 @@
<td>大份</td> <td>大份</td>
<td>生生蔬菜店</td> <td>生生蔬菜店</td>
<td>¥12.00</td> <td>¥12.00</td>
<td>上架</td>
<td>双倍积分</td> <td>双倍积分</td>
<td>5</td> <td>5</td>
<td>
<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</td>
<td> <td>
<div class="action-buttons"> <div class="action-buttons">
<button class="btn-edit">编辑</button> <button class="btn-edit">编辑</button>
<button class="btn-delete">删除</button>
</div> </div>
</td> </td>
</tr> </tr>
@ -329,12 +456,18 @@
<td>中份</td> <td>中份</td>
<td>生生蔬菜店</td> <td>生生蔬菜店</td>
<td>¥6.00</td> <td>¥6.00</td>
<td>上架</td>
<td>双倍积分</td> <td>双倍积分</td>
<td>8</td> <td>8</td>
<td>
<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</td>
<td> <td>
<div class="action-buttons"> <div class="action-buttons">
<button class="btn-edit">编辑</button> <button class="btn-edit">编辑</button>
<button class="btn-delete">删除</button>
</div> </div>
</td> </td>
</tr> </tr>
@ -347,18 +480,185 @@
<td>大份</td> <td>大份</td>
<td>生生蔬菜店</td> <td>生生蔬菜店</td>
<td>¥4.50</td> <td>¥4.50</td>
<td>上架</td>
<td>双倍积分</td> <td>双倍积分</td>
<td>15</td> <td>15</td>
<td>
<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</td>
<td> <td>
<div class="action-buttons"> <div class="action-buttons">
<button class="btn-edit">编辑</button> <button class="btn-edit">编辑</button>
<button class="btn-delete">删除</button>
</div> </div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
<div id="double-points" class="tab-content">
<div class="search-section">
<div class="search-row">
<div class="form-group">
<label>商铺:</label>
<select class="form-control">
<option value="">生生蔬菜店</option>
<option value="">其他店铺</option>
</select>
</div>
<div class="form-group">
<label>商品ID</label>
<input type="text" class="form-control" placeholder="请输入商品ID">
</div>
<div class="form-group">
<label>商品名称:</label>
<input type="text" class="form-control" placeholder="请输入商品名称">
</div>
<div class="form-group">
<button class="btn btn-primary">查询</button>
<button class="btn">重置</button>
</div>
</div>
<button class="btn btn-success add-btn">添加</button>
</div>
<div class="table-container">
<table class="data-table">
<thead>
<tr>
<th width="50">
<input type="checkbox" class="checkbox">
</th>
<th width="100">商品ID</th>
<th width="150">商品名称</th>
<th width="150">归属店铺</th>
<th width="100">商品原价</th>
<th width="120">原有商品状态</th>
<th width="120">操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="checkbox" class="checkbox">
</td>
<td>001</td>
<td>黑木耳</td>
<td>生生蔬菜店</td>
<td>¥5.00</td>
<td>上架</td>
<td>
<div class="action-buttons">
<button class="btn-delete">删除</button>
</div>
</td>
</tr>
<tr>
<td>
<input type="checkbox" class="checkbox">
</td>
<td>002</td>
<td>黑木耳</td>
<td>生生蔬菜店</td>
<td>¥8.00</td>
<td>上架</td>
<td>
<div class="action-buttons">
<button class="btn-delete">删除</button>
</div>
</td>
</tr>
<tr>
<td>
<input type="checkbox" class="checkbox">
</td>
<td>003</td>
<td>番茄</td>
<td>生生蔬菜店</td>
<td>¥3.50</td>
<td>下架</td>
<td>
<div class="action-buttons">
<button class="btn-delete">删除</button>
</div>
</td>
</tr>
<tr>
<td>
<input type="checkbox" class="checkbox">
</td>
<td>004</td>
<td>冬瓜</td>
<td>生生蔬菜店</td>
<td>¥12.00</td>
<td>上架</td>
<td>
<div class="action-buttons">
<button class="btn-delete">删除</button>
</div>
</td>
</tr>
<tr>
<td>
<input type="checkbox" class="checkbox">
</td>
<td>005</td>
<td>土豆</td>
<td>生生蔬菜店</td>
<td>¥6.00</td>
<td>上架</td>
<td>
<div class="action-buttons">
<button class="btn-delete">删除</button>
</div>
</td>
</tr>
<tr>
<td>
<input type="checkbox" class="checkbox">
</td>
<td>006</td>
<td>白萝卜</td>
<td>生生蔬菜店</td>
<td>¥4.50</td>
<td>上架</td>
<td>
<div class="action-buttons">
<button class="btn-delete">删除</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div> </div>
<script>
function switchTab(evt, tabName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].classList.remove("active");
}
tablinks = document.getElementsByClassName("tab-button");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].classList.remove("active");
}
document.getElementById(tabName).classList.add("active");
evt.currentTarget.classList.add("active");
}
</script>
</body> </body>
</html> </html>Test line

Binary file not shown.