gpt4 book ai didi

git - 查找文件类型的所有 git 提交

转载 作者:太空狗 更新时间:2023-10-29 13:10:25 26 4
gpt4 key购买 nike

查找包含特定文件的所有提交非常简单。

git log -- .\Database\Tables\sometable.sql

但是是否有一种简单的方法来查找文件类型的所有提交(递归地向下子目录?)或者我是否需要编写脚本来执行此操作?

(概念上...)

git log -- .\Database\*.sql --recursive

最佳答案

看来您可能只需要对 * 进行转义,这样它就不会被命令行扩展。看起来你在 Windows 上,所以......但我在 Linux 上并像这样测试:

git init
mkdir -p blue/red/green
touch blue/red/green/colors
git add blue/red/green/colors
git commit -m "colors and dirs"
touch blackAndWhite
git add blackAndWhite
git commit -m 'b&w'
git log -- \*ors

最后一个git log的结果是:

commit 8fdb718b5b616dd495c00eb7a6d123c33f7707e5
Author: <snipped>
Date: Sun Oct 14 19:49:43 2012 -0400

colors and dirs

在 Windows 上转义 *... 也许将它放在单引号或双引号中?如果我想通了,我会补充。

关于git - 查找文件类型的所有 git 提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12887580/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com