Metadata-Version: 2.4
Name: diff-tweezers
Version: 0.3.3
Summary: Interactive terminal diff chunk splitter
Author-email: Eric Gaudet <gaudeteric@email.com>
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Tweezers

Interactive terminal tool for splitting unified diffs by chunk.

![example](/assets/Screenshot_tweezers.png)

## Install

```bash
pip3 install diff-tweezers
```

On Windows, also install:
```bash
pip3 install windows-curses
```

## Usage

### Git Mode (recommended)

**Stage hunks interactively** (like `git add -p`, but better):
```bash
tweezers --git
```
Select hunks to stage, then they're added to the index. Unselected hunks remain in your working tree.

**Cherry-pick hunks from a commit**:
```bash
tweezers --git <commit>
tweezers --git HEAD~3
tweezers --git feature-branch
```
Select hunks to apply to your working tree. Useful for partially applying commits or extracting changes from another branch.

**Partially revert unstaged changes**:
```bash
tweezers --revert
```
Select hunks to revert from your working tree. Useful for undoing parts of your current changes.

**Cherry-pick revert hunks from a commit**:
```bash
tweezers --revert <commit>
tweezers --revert HEAD~3
tweezers --revert feature-branch
```
Select hunks to revert from a commit and apply to your working tree. Useful for partially reverting commits or changes from another branch.

### File Mode

Process a standalone patch file:
```bash
tweezers my.patch
```
Outputs `left.patch` (unselected hunks) and `right.patch` (selected hunks).

### Options

| Option | Description |
|--------|-------------|
| `--git` | Stage hunks from working tree (like `git add -p`) |
| `--git <commit>` | Cherry-pick hunks from a commit to working tree |
| `--revert` | Revert hunks from working tree (undo selected changes) |
| `--revert <commit>` | Cherry-pick revert hunks from a commit to working tree |
| `--save` | Save `right.patch` file in git mode, `revert.patch` in revert mode |
| `--version` | Show version |

## Keybindings

| Key | Action |
|-----|--------|
| `j` / `↓` | Move down |
| `k` / `↑` | Move up |
| `Space` | Toggle selection |
| Tab | Toggle Fold / Unfold |
| `s` | Split chunk at context boundaries |
| `]` / `}` | Next file |
| `[` / `{` | Previous file |
| `c` | Confirm and exit |

## License

MIT
