|
| 1 | +# Git Markdown Diff Tool |
| 2 | + |
| 3 | +A powerful CLI tool that generates beautifully formatted markdown files from git diffs, making code changes more readable and shareable. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- 📝 Generates markdown files for each changed file in your git repository |
| 8 | +- 🎨 Syntax-highlighted diff output |
| 9 | +- 📊 Includes file statistics and change summaries |
| 10 | +- 🔍 Automatic exclusion of common build artifacts and sensitive files |
| 11 | +- 📁 Creates an organized directory structure with an index |
| 12 | +- 💡 Support for comparing specific commits, branches, or tags |
| 13 | +- 🚀 Progress indicators for long-running operations |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +```bash |
| 18 | +npm install -g git-markdown-diff |
| 19 | +``` |
| 20 | + |
| 21 | +## Usage |
| 22 | + |
| 23 | +### Basic Usage |
| 24 | + |
| 25 | +To generate diffs between your working tree and the last commit: |
| 26 | + |
| 27 | +```bash |
| 28 | +git-markdown-diff |
| 29 | +``` |
| 30 | + |
| 31 | +### Comparing Specific References |
| 32 | + |
| 33 | +To generate diffs between specific git references (commits, branches, or tags): |
| 34 | + |
| 35 | +```bash |
| 36 | +git-markdown-diff <startRef> <endRef> |
| 37 | +``` |
| 38 | + |
| 39 | +Examples: |
| 40 | +```bash |
| 41 | +# Compare between two commits |
| 42 | +git-markdown-diff abc123 def456 |
| 43 | + |
| 44 | +# Compare between branches |
| 45 | +git-markdown-diff main feature/new-feature |
| 46 | + |
| 47 | +# Compare between tags |
| 48 | +git-markdown-diff v1.0.0 v1.1.0 |
| 49 | +``` |
| 50 | + |
| 51 | +## Output Structure |
| 52 | + |
| 53 | +The tool creates a `git-diffs` directory with the following structure: |
| 54 | + |
| 55 | +``` |
| 56 | +git-diffs/ |
| 57 | +├── README.md # Index file with summary and links |
| 58 | +├── src/ # Mirrors your repository structure |
| 59 | +│ ├── file1.js.md # Diff for file1.js |
| 60 | +│ └── components/ |
| 61 | +│ └── Component.js.md # Diff for Component.js |
| 62 | +└── ... |
| 63 | +``` |
| 64 | + |
| 65 | +### Generated Files |
| 66 | + |
| 67 | +Each generated markdown file includes: |
| 68 | + |
| 69 | +- File path and name |
| 70 | +- File change statistics |
| 71 | +- Syntax-highlighted diff content |
| 72 | +- Timestamp and timezone information |
| 73 | +- Dark-mode friendly styling |
| 74 | + |
| 75 | +## Excluded Files |
| 76 | + |
| 77 | +The tool automatically excludes common files that typically don't need diff review: |
| 78 | + |
| 79 | +- Package manager locks (package-lock.json, yarn.lock, etc.) |
| 80 | +- Dependencies (node_modules/, vendor/) |
| 81 | +- Build outputs (dist/, build/, .next/, etc.) |
| 82 | +- IDE and OS files (.idea/, .vscode/, .DS_Store, etc.) |
| 83 | +- Logs and debug files |
| 84 | +- Environment and secret files |
| 85 | +- Minified files |
| 86 | + |
| 87 | +## Contributing |
| 88 | + |
| 89 | +We welcome contributions to improve the Git Markdown Diff Tool! Here's how you can help: |
| 90 | + |
| 91 | +### Development Setup |
| 92 | + |
| 93 | +1. Fork the repository |
| 94 | +2. Clone your fork: |
| 95 | + ```bash |
| 96 | + git clone https://github.com/your-username/git-markdown-diff.git |
| 97 | + ``` |
| 98 | +3. Install dependencies: |
| 99 | + ```bash |
| 100 | + npm install |
| 101 | + ``` |
| 102 | +4. Create a new branch: |
| 103 | + ```bash |
| 104 | + git checkout -b feature/your-feature-name |
| 105 | + ``` |
| 106 | + |
| 107 | +### Development Guidelines |
| 108 | + |
| 109 | +- Follow the existing code style |
| 110 | +- Add tests for new features |
| 111 | +- Update documentation as needed |
| 112 | +- Ensure all tests pass before submitting a pull request |
| 113 | + |
| 114 | +### Submitting Changes |
| 115 | + |
| 116 | +1. Commit your changes with clear, descriptive commit messages |
| 117 | +2. Push to your fork |
| 118 | +3. Submit a pull request with a clear description of the changes |
| 119 | + |
| 120 | +### Areas for Contribution |
| 121 | + |
| 122 | +- Additional file exclusion patterns |
| 123 | +- Custom styling options |
| 124 | +- Support for different markdown formats |
| 125 | +- Performance improvements |
| 126 | +- Documentation improvements |
| 127 | +- Bug fixes |
| 128 | + |
| 129 | +## License |
| 130 | + |
| 131 | +MIT |
| 132 | + |
| 133 | +## Acknowledgments |
| 134 | + |
| 135 | +This tool uses several open-source packages: |
| 136 | +- commander - For CLI argument parsing |
| 137 | +- ora - For progress indicators |
| 138 | + |
| 139 | +## Troubleshooting |
| 140 | + |
| 141 | +### Common Issues |
| 142 | + |
| 143 | +1. **Git command failed** |
| 144 | + - Ensure you're in a git repository |
| 145 | + - Verify git is installed and accessible from command line |
| 146 | + |
| 147 | +2. **Permission errors** |
| 148 | + - Check write permissions in the output directory |
| 149 | + - Run with appropriate privileges |
| 150 | + |
| 151 | +3. **Memory issues with large repositories** |
| 152 | + - Tool uses a 10MB buffer for git operations |
| 153 | + - Consider using specific commit ranges instead of full history |
| 154 | + |
| 155 | +### Getting Help |
| 156 | + |
| 157 | +- Open an issue on GitHub for bugs |
| 158 | +- Start a discussion for feature requests |
| 159 | +- Check existing issues before creating new ones |
| 160 | + |
| 161 | +## Roadmap |
| 162 | + |
| 163 | +Future improvements under consideration: |
| 164 | + |
| 165 | +- [ ] Custom output directory option |
| 166 | +- [ ] HTML export option |
| 167 | +- [ ] Integration with CI/CD pipelines |
| 168 | +- [ ] Custom exclusion patterns |
| 169 | +- [ ] Multiple diff format support |
| 170 | +- [ ] Interactive mode for file selection |
0 commit comments