You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何不切换分支获取远程分支指定范围的C#文件提交历史(含注释)

针对远程分支的指定范围变更查询方案

无需切换分支,直接通过以下Git命令满足你的所有需求:

1. 查询提交历史(含注释、变更文件列表)

git log --since="2022-07-03" --until="2022-09-01" -- Source/Some/Custom/Dir/*.cs origin/extra_branch

2. 查询提交历史+具体变更内容

如果需要查看每个提交的代码diff,添加-p参数:

git log -p --since="2022-07-03" --until="2022-09-01" -- Source/Some/Custom/Dir/*.cs origin/extra_branch

3. 简洁版提交历史

若需要更紧凑的输出,使用--oneline参数:

git log --oneline --since="2022-07-03" --until="2022-09-01" -- Source/Some/Custom/Dir/*.cs origin/extra_branch

参数说明

  • --since/--until:精准限定提交的时间范围(2022年7月3日至9月1日)
  • -- Source/Some/Custom/Dir/*.cs:锁定目标目录下的所有.cs文件,过滤无关变更
  • origin/extra_branch:直接指定远程分支,无需本地检出,完全避免依赖配置重置问题
  • -p:显示每个提交的具体代码变更内容
  • --oneline:将每个提交压缩为一行显示,包含简短哈希和提交注释

内容的提问来源于stack exchange,提问作者Digika

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 21:15:44