Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

find all git commits for a file type

Tags:

git

posh-git

its pretty simple to find all the commits containing a particular file.

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

but is there a simple way to find all the commits for a file type (recursively down child directories?) or will I need to write a script to do this?

(conceptually...)

git log -- .\Database\*.sql --recursive
like image 345
Tim Jarvis Avatar asked Oct 14 '12 23:10

Tim Jarvis


People also ask

How do you see all commits for a file?

Use git log --all <filename> to view the commits influencing <filename> in all branches.

How do I see all files committed in git?

In Git, we can use git show commit_id --name-only to list all the committed files that are going to push to the remote repository.

How do you see which files were changed in a commit?

Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command. It's the fastest and simplest way to get insight into which files a commit affects.


1 Answers

It appears that perhaps you just need to escape the * so that it doesn't get expanded by the command line. It would seem that you are on Windows so... but I am on Linux and tested like so:

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

The result on the last git log is:

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

    colors and dirs

On the Windows escaping of *... perhaps put it in either single or double quotes? I'll add if I figure something out.

like image 124
altendky Avatar answered Oct 12 '22 19:10

altendky