git 怎么导出提交历史,文件是乱码

乱码问题通常是编码格式导致的。在 Windows 的 PowerShell 中,Git 默认使用 UTF-8 输出,而系统可能期望 GBK/GB2312 编码。

解决方案:

  1. 指定编码格式导出(推荐)
bash 复制代码
# 方法 1:使用 chcp 切换代码页
chcp 65001
git log --pretty=format:"%h,%an,%ad,%s" --date=short > commits.csv

# 方法 2:切换到 GBK 编码
chcp 936
git log --pretty=format:"%h,%an,%ad,%s" --date=short > commits.csv

我在文件里用的936

相关推荐
Selina K7 分钟前
在windows安装git
git
周杰伦fans7 小时前
如何将 Feature 分支同步到 Master 主分支:一次完整的 Git 合并实战
git
jiayi_19997 小时前
git创建new branch
git
__Witheart__7 小时前
通过交互式 Rebase 合并部分提交到远程分支的操作步骤
git
魔都吴所谓9 小时前
【Tools】Repo 工具完整使用手册
git
tianyuanwo9 小时前
跨 Gerrit 项目迁移分支并保留完整历史:一份可操作的 Git 指南
git·代码迁移
玄奕子9 小时前
VS Code 上传 GitHub 全流程(Windows 环境):HTTP 与 SSH 两种方案(含常见报错排查)
git·http·ssh·github·嵌入式开发
一只游鱼9 小时前
如何让本地的敏感配置文件不上传到git仓库
git·elasticsearch
渣渣馬1 天前
shell的if多条件
git·ssh
zh_xuan1 天前
Visual Studio 上传工程到github
ide·git·github·visual studio