# 常用配置模板

URL: https://caijiao.org/git/appendix/config-template
Source: docs/git/appendix/config-template.md
Description: 本章汇总常用的 Git 配置模板，帮助用户快速设置和优化 Git 使用体验。

Git 提供多种配置选项，通过设置提升使用效率和协作规范。

## 用户信息配置

```bash
git config --global user.name "你的名字"
git config --global user.email "你的邮箱"
```

## 设置默认编辑器

```bash
git config --global core.editor "vim"
# 或者使用其他编辑器，如 nano、code --wait
```

## 配置常用别名

```bash
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.cm commit
git config --global alias.last "log -1 HEAD"
```

## 设置合并工具

```bash
git config --global merge.tool meld
git config --global mergetool.prompt false
```

## 忽略文件大小写变化（Windows）

```bash
git config --global core.ignorecase true
```

## 配置颜色显示

```bash
git config --global color.ui auto
```

## 配置凭证缓存

```bash
git config --global credential.helper cache
# 缓存默认 15 分钟，可设置时间（秒）
git config --global credential.helper 'cache --timeout=3600'
```

通过这些配置，可以让 Git 操作更加顺畅，提升开发效率。
