Skip to content

Efficiently search text across different Git commits, with support for Excel and text files.

License

Notifications You must be signed in to change notification settings

EntityProcess/GitContentSearch

Repository files navigation

GitContentSearch

Overview

GitContentSearch is the ideal tool if you've ever wanted to do git blame on Excel files. This tool comes in two flavors - a command-line interface (CLI) and a graphical user interface (UI). It allows you to efficiently search for content across different Git commits in Excel files (.xls, .xlsx) and text files (.txt, .sql, .cs, etc.), making it a powerful solution for tracking changes even in non-text formats.

The app identifies the commit where the search string appears, using an optimized binary search algorithm for faster results in large commit histories. Progress is logged to a file, allowing you to resume the search if interrupted.

Note: Currently, the application has been primarily tested on Windows and may not work properly on Linux/MacOS. Cross-platform support is planned for future releases.

GitContentSearch UI Main Window

Features

  • Two Interfaces: Choose between a CLI for automation and scripting, or a modern UI for a more visual experience.
  • Optimized Search: Quickly identifies the commit where the search string first appears and last disappears.
  • Searches Across Multiple File Types: Search in Excel files (.xls, .xlsx) and text files (.txt, .sql, .cs, etc.).
  • Log File: Keeps track of all checked commits and results, allowing you to continue the search later.
  • Commit Range: Specify an earliest and latest commit to limit the search scope.
  • Follow File History: Use the --follow option (CLI) or toggle in UI to follow file renames and history across commits.

Download Windows Binaries

You can download the Windows binaries from the releases page:

If you don't trust the binaries, you can perform the build steps below.

Installation

Clone the repository:

git clone https://github.com/entityprocess/GitContentSearch.git
cd GitContentSearch

Build the application:

dotnet publish -c Release

CLI Installation

The CLI executable will be available at:

/path/to/your/git/repository/GitContentSearch/bin/Release/netX.X/publish/

Add this folder to your PATH environment variable to run the tool from any directory in your command line.

UI Installation

The UI executable will be available at:

/path/to/your/git/repository/GitContentSearch.UI/bin/Release/netX.X/publish/

For easy access, you can create a shortcut to GitContentSearch.UI.exe on your desktop from the publish folder.

Usage

UI Version

  1. Launch GitContentSearch.UI.exe
  2. Configure your Git repository settings
  3. Enter the file path and search string
  4. Optionally set commit range and other search options
  5. Click Search to begin

CLI Version

1. Navigate to your Git directory:

Before running the tool, ensure you're in the directory where your Git repository is located:

cd /path/to/your/git/repository

2. Run the tool:

GitContentSearch.exe <remote-file-path> <search-string> [--earliest-commit=<commit>] [--latest-commit=<commit>] [--working-directory=<path>] [--log-directory=<path>] [--follow]

CLI Arguments

  • <file-path>: The path to the Content file within the Git repository.
  • <search-string>: The string you want to search for in the Content file.
  • --earliest-commit=<commit>: (Optional) The earliest commit to begin the search.
  • --latest-commit=<commit>: (Optional) The latest commit to end the search.
  • --working-directory=<path>: (Optional) The directory where Git commands should be executed. Defaults to the user's temp directory if not provided.
  • --log-directory=<path>: (Optional) The directory where the log file and temporary files will be stored. Defaults to the user's temp directory if not provided.
  • --follow: (Optional) Follow file renames and history across commits.

CLI Example

GitContentSearch.exe "path/to/your/file.xlsx" "SearchString" --earliest-commit=abc123 --latest-commit=def456 --working-directory="/your/git/repo" --log-directory="/your/log/directory" --follow

This will search for the string "SearchString" within the specified commit range, using the specified working directory for Git operations and storing logs and temporary files in the specified log directory.

Note: The file is the remote path (e.g. path/to/your/file.xlsx), not the local path (e.g. c:/repo/path/to/your/file.xlsx).

Output

Search Log: A file named search_log.txt is created in the log directory, detailing the commits checked and whether the string was found. The log directory is also used to store any temporary files generated during the search process.

Dependencies

  • Git: Make sure Git is installed on your system, as the app relies on the git show command.
  • NPOI: NPOI is a .NET library that provides support for reading and writing Microsoft Office formats, including Content (.xls, .xlsx). It's used in this project to process Excel files.
  • AvaloniaUI: The UI version is built using AvaloniaUI, a cross-platform UI framework for .NET.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.

About

Efficiently search text across different Git commits, with support for Excel and text files.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages