|
1 | 1 | # diff-server |
2 | 2 |
|
3 | | -A tiny Go program that shows git diffs in the current directory and all git repositories in subdirectories. |
| 3 | +A lightweight Go web server that displays git diffs from the current directory and all git repositories in subdirectories. It provides a clean, real-time web interface for viewing uncommitted changes across multiple repositories in your workspace. |
| 4 | + |
| 5 | +Like `jq`, it is a single tiny binary without dependencies, making it easy to install and use anywhere. |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +### Supported Platforms |
| 10 | + |
| 11 | +Binaries are available for: |
| 12 | +- **Linux**: 386, amd64, arm64 |
| 13 | +- **macOS**: amd64 (Intel), arm64 (Apple Silicon) |
| 14 | + |
| 15 | +### Download and Install |
| 16 | + |
| 17 | +Download the binary for your platform from the [release page](https://github.com/kitproj/diff-server/releases). |
| 18 | + |
| 19 | +#### Linux |
| 20 | + |
| 21 | +**For Linux (amd64):** |
| 22 | +```bash |
| 23 | +sudo curl -fsL -o /usr/local/bin/diff-server https://github.com/kitproj/diff-server/releases/download/v0.0.1/diff-server_v0.0.1_linux_amd64 |
| 24 | +sudo chmod +x /usr/local/bin/diff-server |
| 25 | +``` |
| 26 | + |
| 27 | +**For Linux (arm64):** |
| 28 | +```bash |
| 29 | +sudo curl -fsL -o /usr/local/bin/diff-server https://github.com/kitproj/diff-server/releases/download/v0.0.1/diff-server_v0.0.1_linux_arm64 |
| 30 | +sudo chmod +x /usr/local/bin/diff-server |
| 31 | +``` |
| 32 | + |
| 33 | +**For Linux (386):** |
| 34 | +```bash |
| 35 | +sudo curl -fsL -o /usr/local/bin/diff-server https://github.com/kitproj/diff-server/releases/download/v0.0.1/diff-server_v0.0.1_linux_386 |
| 36 | +sudo chmod +x /usr/local/bin/diff-server |
| 37 | +``` |
| 38 | + |
| 39 | +#### macOS |
| 40 | + |
| 41 | +**For macOS (Apple Silicon/arm64):** |
| 42 | +```bash |
| 43 | +sudo curl -fsL -o /usr/local/bin/diff-server https://github.com/kitproj/diff-server/releases/download/v0.0.1/diff-server_v0.0.1_darwin_arm64 |
| 44 | +sudo chmod +x /usr/local/bin/diff-server |
| 45 | +``` |
| 46 | + |
| 47 | +**For macOS (Intel/amd64):** |
| 48 | +```bash |
| 49 | +sudo curl -fsL -o /usr/local/bin/diff-server https://github.com/kitproj/diff-server/releases/download/v0.0.1/diff-server_v0.0.1_darwin_amd64 |
| 50 | +sudo chmod +x /usr/local/bin/diff-server |
| 51 | +``` |
| 52 | + |
| 53 | +#### Verify Installation |
| 54 | + |
| 55 | +After installing, verify the installation works: |
| 56 | +```bash |
| 57 | +diff-server -h |
| 58 | +``` |
| 59 | + |
| 60 | +### Build from Source |
| 61 | + |
| 62 | +If you prefer to build from source: |
| 63 | + |
| 64 | +```bash |
| 65 | +git clone https://github.com/kitproj/diff-server.git |
| 66 | +cd diff-server |
| 67 | +go build -o diff-server . |
| 68 | +``` |
4 | 69 |
|
5 | 70 |  |
6 | 71 |
|
7 | 72 | ## Usage |
8 | 73 |
|
| 74 | +### Starting the Server |
| 75 | + |
| 76 | +**Run with default settings (port 3844, current directory):** |
9 | 77 | ```bash |
10 | | -# Build |
11 | | -go build -o diff-server . |
| 78 | +diff-server |
| 79 | +``` |
| 80 | + |
| 81 | +**Run on a custom port:** |
| 82 | +```bash |
| 83 | +diff-server -p 9000 |
| 84 | +``` |
| 85 | + |
| 86 | +**Scan a different directory:** |
| 87 | +```bash |
| 88 | +diff-server -C /path/to/workspace |
| 89 | +``` |
| 90 | + |
| 91 | +**Combine options:** |
| 92 | +```bash |
| 93 | +diff-server -p 8080 -C ~/projects |
| 94 | +``` |
| 95 | + |
| 96 | +### Viewing Diffs |
12 | 97 |
|
13 | | -# Run (default port 3844, current directory) |
14 | | -./diff-server |
| 98 | +After starting the server, open your web browser and navigate to: |
| 99 | +``` |
| 100 | +http://localhost:3844 |
| 101 | +``` |
15 | 102 |
|
16 | | -# Run on custom port |
17 | | -./diff-server -p 9000 |
| 103 | +The web interface will automatically: |
| 104 | +- Display all uncommitted changes in the current directory (if it's a git repository) |
| 105 | +- Recursively scan subdirectories for git repositories |
| 106 | +- Show diffs from all discovered repositories |
| 107 | +- Auto-refresh every 10 seconds to show new changes |
18 | 108 |
|
19 | | -# Scan a different directory |
20 | | -./diff-server -C /path/to/workspace |
| 109 | +### Command-Line Options |
| 110 | + |
| 111 | +```bash |
| 112 | +Usage of diff-server: |
| 113 | + -C string |
| 114 | + Directory to scan for git repositories (default ".") |
| 115 | + -p string |
| 116 | + Port to listen on (default "3844") |
21 | 117 | ``` |
22 | 118 |
|
23 | | -Then open http://localhost:3844 (or your custom port) in a browser to view the diffs. |
| 119 | +## Features |
| 120 | + |
| 121 | +- **Multi-repository support**: Automatically discovers and displays diffs from all git repositories in subdirectories |
| 122 | +- **Real-time updates**: The web interface polls for changes every 10 seconds |
| 123 | +- **Clean UI**: Uses Diff2Html for a beautiful, syntax-highlighted diff view |
| 124 | +- **Untracked files**: Shows new files that haven't been added to git yet |
| 125 | +- **Lightweight**: Single binary with no runtime dependencies |
| 126 | +- **Fast**: Efficient scanning and rendering of diffs |
| 127 | + |
| 128 | +## Use Cases |
| 129 | + |
| 130 | +- **Code review**: Quickly review all changes across multiple projects before committing |
| 131 | +- **Workspace monitoring**: Keep an eye on what's changed in your development workspace |
| 132 | +- **Pair programming**: Share a link to show your current work to teammates |
| 133 | +- **CI/CD**: Run in a pipeline to visualize changes before deployment |
| 134 | + |
| 135 | +## Troubleshooting |
| 136 | + |
| 137 | +### Common Issues |
| 138 | + |
| 139 | +**"Cannot connect" or server not accessible** |
| 140 | +- Verify the server is running: check the terminal for the startup message |
| 141 | +- Ensure the port is not already in use by another application |
| 142 | +- Try a different port: `diff-server -p 8080` |
| 143 | + |
| 144 | +**No diffs showing** |
| 145 | +- Ensure you're in a directory that contains git repositories |
| 146 | +- Check that you have uncommitted changes: `git status` |
| 147 | +- Verify the directory path if using `-C` flag |
| 148 | + |
| 149 | +**Large diffs not fully displayed** |
| 150 | +- The server limits output to 5MB per request to prevent memory issues |
| 151 | +- Consider committing some changes or viewing specific repositories separately |
| 152 | + |
| 153 | +**Permission denied when installing** |
| 154 | +- Use `sudo` when installing to `/usr/local/bin` |
| 155 | +- Alternatively, install to a user-owned directory like `~/bin` and add it to your PATH |
| 156 | + |
| 157 | +### Getting Help |
| 158 | + |
| 159 | +- Report issues: https://github.com/kitproj/diff-server/issues |
| 160 | +- Check existing issues for solutions and workarounds |
0 commit comments