A command-line/pre-commit tool to remove emojis from code files.
Because your code deserves better than AI-generated emoji spam. Built with Rust for blazing-fast emoji annihilation.
- Fast: Multi-threaded processing using Rayon
- Smart: Respects
.gitignorefiles by default - Flexible: Process individual files or entire directories
- Safe: Dry-run mode to preview changes before applying
- Clean: Removes trailing spaces left after emoji removal
- Zero Dependencies: Single binary with no runtime dependencies
- Install as a Git Pre-commit Hook: Follow the instructions below to set up emoji-remover as a pre-commit hook.
cargo install emoji-removerDownload the latest release from the releases page.
# Remove emojis from a single file
emoji-remover path/to/file.rs
# Remove emojis from an entire directory
emoji-remover path/to/project/
# Dry run - see what would be removed without making changes
emoji-remover --dry-run path/to/project/
# Process specific file extensions only
emoji-remover --extensions "rs,js,ts" path/to/project/
# Ignore .gitignore files
emoji-remover --no-ignore path/to/project/
# Quiet mode - only show files with changes
emoji-remover --quiet path/to/project/Create .git/hooks/pre-commit in your repository:
#!/bin/bash
echo "Running emoji remover..."
# Get list of staged files
FILES=$(git diff --cached --name-only --diff-filter=ACM)
if [ -n "$FILES" ]; then
# Run emoji-remover on staged files only
echo "$FILES" | xargs emoji-remover --quiet
# Re-add the modified files
echo "$FILES" | xargs git add
fi
exit 0Then make it executable:
chmod +x .git/hooks/pre-commitThe repository includes an installation script:
# Clone and build
git clone https://github.com/jamiepine/emoji-remover.git
cd emoji-remover
cargo build --release
# Install as pre-commit hook in your project
cd /path/to/your/project
/path/to/emoji-remover/install-pre-commit.sh-d, --dry-run Perform a dry run without modifying files
-e, --extensions File extensions to process (comma-separated)
-q, --quiet Quiet mode - only show files with changes
--no-ignore Don't respect .gitignore files
-h, --help Print help
By default, emoji-remover processes files with these extensions:
rs, js, ts, jsx, tsx, py, java, c, cpp, h, hpp, go, rb, php, cs, swift, kt, scala, md, txt
The emoji data used by this tool is sourced from Emoji-List-Unicode, which provides a comprehensive list of emojis from the Unicode official website.
The tool includes:
- All standard emojis from
all-emoji.json - Emoji variations with skin tone modifiers from
full-emoji-modifiers.json
The emoji data is processed at compile time using a Rust build script (build.rs). This approach:
- Embeds all emoji patterns directly into the binary
- Eliminates runtime file I/O for emoji data
- Results in a single, self-contained executable
- Multi-threaded file processing using Rayon
- Efficient
.gitignorehandling via theignorecrate - Zero-allocation string replacements where possible
- Typical processing speed: ~1000 files/second on modern hardware
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Emoji data from Emoji-List-Unicode
- Built with Rust and the amazing Rust ecosystem