Skip to content

m4ce/git-find

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Git find

A minimal GNU-style find implementation for Git. This utility allows for pattern searching in the Git history and optionally take actions over it.

Examples

Delete all files greater than 1M from the history

git find --size +1M --delete

Delete all files that match '*.gz' from the history

git find --name '*.gz' --delete

Delete all files that match '*.txt' and are located within a 'reports' directory from the history

git find --name '*.gz' --path '*/reports/*' --delete

You can also specify an arbitrary command to execute. The following variables will be interpolated: %{mode}, %{type}, %{sha}, %{size}, %{path}

git find --name '*.gz' --path '*/reports/*' --exec 'git cat-files %{type} %{sha}'

Formatted output is implemented as follows

git find --printf '%{sha} %{path} %{size}'

and so forth.

Installation

The script needs to be made available on your PATH in order for git to have find as an additional command-line action.

Todo

  1. Implement -type option
  2. Implement find-alike expressions and operators (e.g. -name x -o -name y)

Contact

Matteo Cerutti - matteo.cerutti@hotmail.co.uk

About

A minimal GNU-style find implementation for Git history

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages