|
| 1 | +# GitContentSearch: Find When a String Was Added and Removed in Git History (Excel & Text) |
| 2 | + |
| 3 | +Welcome to **GitContentSearch**, a free, powerful tool designed to pinpoint the exact Git commits where a specific string was *first introduced* and *last removed* from your files. It works with both legacy Excel files (.xls, .xlsx) and text-based files (.txt, .sql, .cs, etc.), making it an indispensable tool for understanding the history of your code and data. GitContentSearch goes beyond `git blame`, providing a fast, binary-search-driven way to find the origin and deletion of any string within your repository's history. |
| 4 | + |
| 5 | +> **Note**: This tool is primarily tested on Windows and may not work properly on Linux/MacOS yet. Cross-platform support is planned for future releases. |
| 6 | +
|
| 7 | + |
| 8 | + |
| 9 | +## Why Use GitContentSearch? |
| 10 | + |
| 11 | +GitContentSearch excels at identifying the *precise* commits responsible for adding and removing specific content, even within binary files like Excel. This capability is invaluable when `git blame` alone isn't enough, especially when dealing with: |
| 12 | + |
| 13 | +* **Legacy Excel Data:** Understand how and when specific data entries or formulas were changed in Excel files. |
| 14 | +* **Refactoring and Code Changes:** Quickly find where a particular function, variable, or configuration setting was first introduced and later removed. |
| 15 | +* **Troubleshooting:** Pinpoint the commit that introduced a bug or unexpected behavior by searching for the relevant code. |
| 16 | +* **Auditing and Compliance:** Demonstrate when and why specific changes were made to critical files. |
| 17 | + |
| 18 | +GitContentSearch logs its progress, allowing you to resume searches if interrupted, a crucial feature for large repositories. **It has been successfully tested on repositories with over 200,000 commits and Excel files up to 10MB in size**, demonstrating its ability to handle substantial projects. |
| 19 | + |
| 20 | +## Key Features |
| 21 | + |
| 22 | +- **Dual Interfaces**: Use the CLI for automation and scripting, or the modern UI for a visual experience. |
| 23 | +- **Fast Binary Search**: Rapidly identifies the *first* and *last* commits where a search string appears. |
| 24 | +- **Multi-File Support**: Search Excel files (.xls, .xlsx) and text files (.txt, .sql, .cs, etc.). |
| 25 | +- **Search Log**: Tracks all checked commits and results, stored in a log file for easy resumption. |
| 26 | +- **Custom Commit Range**: Specify an earliest and latest commit to narrow the search scope. |
| 27 | +- **File History Tracking**: Use the `--follow` option (CLI) or UI toggle to trace file renames and movements across commits. |
| 28 | + |
| 29 | +## Download Windows Binaries |
| 30 | + |
| 31 | +Get started today with the free Windows binaries available on the [releases page](https://github.com/EntityProcess/GitContentSearch/releases/latest): |
| 32 | + |
| 33 | +- **CLI**: [GitContentSearch_CLI_win_x64.zip](https://github.com/EntityProcess/GitContentSearch/releases/latest) |
| 34 | +- **GUI**: [GitContentSearch_UI_win_x64.zip](https://github.com/EntityProcess/GitContentSearch/releases/latest) |
| 35 | + |
| 36 | +Build the tool yourself using the steps below for enhanced security. |
| 37 | + |
| 38 | +## Installation Guide |
| 39 | + |
| 40 | +### Step 1: Clone the Repository |
| 41 | +Clone the GitContentSearch repo to your local machine: |
| 42 | +```bash |
| 43 | +git clone https://github.com/EntityProcess/GitContentSearch.git |
| 44 | +cd GitContentSearch |
| 45 | +``` |
| 46 | + |
| 47 | +### Step 2: Build the Application |
| 48 | +Compile the tool using .NET: |
| 49 | + |
| 50 | +```bash |
| 51 | +dotnet publish -c Release |
| 52 | +``` |
| 53 | + |
| 54 | +### CLI Installation |
| 55 | +The CLI executable will be located at: |
| 56 | + |
| 57 | +``` |
| 58 | +/path/to/your/git/repository/GitContentSearch/bin/Release/netX.X/publish/ |
| 59 | +``` |
| 60 | +Add this folder to your PATH environment variable for easy access from any command line. |
| 61 | + |
| 62 | +### UI Installation |
| 63 | +The UI executable will be at: |
| 64 | + |
| 65 | +``` |
| 66 | +/path/to/your/git/repository/GitContentSearch.UI/bin/Release/netX.X/publish/ |
| 67 | +``` |
| 68 | +Create a desktop shortcut to `GitContentSearch.UI.exe` for convenience. |
| 69 | + |
| 70 | +## How to Use GitContentSearch |
| 71 | + |
| 72 | +### Using the UI Version |
| 73 | +1. Launch `GitContentSearch.UI.exe`. |
| 74 | +2. Configure your Git repository settings. |
| 75 | +3. Enter the file path and search string. |
| 76 | +4. Set optional commit range and search options. |
| 77 | +5. Click Search to start. |
| 78 | + |
| 79 | +### Using the CLI Version |
| 80 | +1. **Navigate to Your Git Directory** |
| 81 | + Ensure you're in your Git repository: |
| 82 | + |
| 83 | + ```bash |
| 84 | + cd /path/to/your/git/repository |
| 85 | + ``` |
| 86 | +2. **Run the Tool** |
| 87 | + Execute the CLI with your parameters: |
| 88 | + |
| 89 | + ```bash |
| 90 | + GitContentSearch.exe <remote-file-path> <search-string> [--earliest-commit=<commit>] [--latest-commit=<commit>] [--working-directory=<path>] [--log-directory=<path>] [--follow] |
| 91 | + ``` |
| 92 | + |
| 93 | +### CLI Arguments |
| 94 | +* `<file-path>`: Remote path to the file in the Git repo (e.g., `path/to/your/file.xlsx`). |
| 95 | +* `<search-string>`: The string to search for. |
| 96 | +* `--earliest-commit=<commit>`: (Optional) Earliest commit to start the search. |
| 97 | +* `--latest-commit=<commit>`: (Optional) Latest commit to end the search. |
| 98 | +* `--working-directory=<path>`: (Optional) Directory for Git commands (defaults to temp directory). |
| 99 | +* `--log-directory=<path>`: (Optional) Directory for logs and temp files (defaults to temp directory). |
| 100 | +* `--follow`: (Optional) Follow file renames and history. |
| 101 | + |
| 102 | +### CLI Example |
| 103 | + |
| 104 | +```bash |
| 105 | +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 |
| 106 | +``` |
| 107 | +This searches for "SearchString" within the specified range, using custom directories, and follows file renames. |
| 108 | + |
| 109 | +## Search Output |
| 110 | +A `search_log.txt` file is created in the log directory, detailing checked commits and whether the string was found. Temporary files are also stored there. |
| 111 | + |
| 112 | +## Dependencies |
| 113 | +* **Git**: Required for Git commands (ensure it’s installed). |
| 114 | +* **NPOI**: [NPOI](https://github.com/nissl-lab/npoi) enables Excel file processing (.xls, .xlsx). |
| 115 | +* **AvaloniaUI**: [AvaloniaUI](https://avaloniaui.net/) powers the cross-platform UI. |
| 116 | + |
| 117 | +## Get Involved |
| 118 | +Contributions are welcome! Submit a pull request or open an issue on the GitHub repository for bugs or feature requests. Help us improve GitContentSearch! |
0 commit comments