将此提示复制到我们的开发者控制台中亲自试用!
| 角色 | 内容 |
|---|---|
| 用户 | 我对本地文件做了一些更改,想要将它们保存到本地 Git 仓库中。我应该使用什么 Git 命令? |
示例输出
要将您对本地文件所做的更改保存到本地 Git 仓库中,您应该使用以下 Git 命令:-
git add .或git add <file>- 此命令暂存您所做的更改,准备提交它们。
.添加当前目录及其子目录中的所有更改。如果您只想暂存特定文件,请将.替换为文件名或路径。
- 此命令暂存您所做的更改,准备提交它们。
-
git commit -m "您的提交消息"- 此命令将暂存的更改提交到您的本地 Git 仓库。
-m标志允许您提供描述所做更改的提交消息。将"您的提交消息"替换为对您更改的简短描述性摘要。
- 此命令将暂存的更改提交到您的本地 Git 仓库。
example.txt 的文件进行了更改,您将运行:
git add example.txt
git commit -m "使用新内容更新 example.txt"
API 请求
- Python
- TypeScript
- AWS Bedrock Python
- AWS Bedrock TypeScript
- Vertex AI Python
- Vertex AI TypeScript
import anthropic
client = anthropic.Anthropic( # defaults to os.environ.get("ANTHROPIC_API_KEY")
api_key="my_api_key",
)
message = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1000,
temperature=0,
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "I have made some changes to my local files and I want to save them in my local Git repository. What Git command should I use?",
}
],
}
],
)
print(message.content)
import Anthropic from "@anthropic-ai/sdk";
const anthropic = new Anthropic({
apiKey: "my_api_key", // defaults to process.env["ANTHROPIC_API_KEY"]
});
const msg = await anthropic.messages.create({
model: "claude-sonnet-4-5",
max_tokens: 1000,
temperature: 0,
messages: [
{
"role": "user",
"content": [
{
"type": "text",
"text": "I have made some changes to my local files and I want to save them in my local Git repository. What Git command should I use?"
}
]
}
]
});
console.log(msg);
from anthropic import AnthropicBedrock
# See https://docs.claude.com/claude/reference/claude-on-amazon-bedrock
# for authentication options
client = AnthropicBedrock()
message = client.messages.create(
model="anthropic.claude-sonnet-4-5-20250929-v1:0",
max_tokens=1000,
temperature=0,
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "I have made some changes to my local files and I want to save them in my local Git repository. What Git command should I use?"
}
]
}
]
)
print(message.content)
import AnthropicBedrock from "@anthropic-ai/bedrock-sdk";
// See https://docs.claude.com/claude/reference/claude-on-amazon-bedrock
// for authentication options
const client = new AnthropicBedrock();
const msg = await client.messages.create({
model: "anthropic.claude-sonnet-4-5-20250929-v1:0",
max_tokens: 1000,
temperature: 0,
messages: [
{
"role": "user",
"content": [
{
"type": "text",
"text": "I have made some changes to my local files and I want to save them in my local Git repository. What Git command should I use?"
}
]
}
]
});
console.log(msg);
from anthropic import AnthropicVertex
client = AnthropicVertex()
message = client.messages.create(
model="claude-sonnet-4@20250514",
max_tokens=1000,
temperature=0,
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "I have made some changes to my local files and I want to save them in my local Git repository. What Git command should I use?"
}
]
}
]
)
print(message.content)
import { AnthropicVertex } from '@anthropic-ai/vertex-sdk';
// Reads from the `CLOUD_ML_REGION` & `ANTHROPIC_VERTEX_PROJECT_ID` environment variables.
// Additionally goes through the standard `google-auth-library` flow.
const client = new AnthropicVertex();
const msg = await client.messages.create({
model: "claude-sonnet-4@20250514",
max_tokens: 1000,
temperature: 0,
messages: [
{
"role": "user",
"content": [
{
"type": "text",
"text": "I have made some changes to my local files and I want to save them in my local Git repository. What Git command should I use?"
}
]
}
]
});
console.log(msg);