Skip to main content

Interactive terminal diff chunk splitter

Project description

Tweezers

Interactive terminal tool for splitting unified diffs by chunk.

example

Install

pip3 install diff-tweezers

On Windows, also install:

pip3 install windows-curses

Usage

Git Mode (recommended)

Stage hunks interactively (like git add -p, but better):

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:

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:

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:

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:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diff_tweezers-0.3.3.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diff_tweezers-0.3.3-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file diff_tweezers-0.3.3.tar.gz.

File metadata

  • Download URL: diff_tweezers-0.3.3.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for diff_tweezers-0.3.3.tar.gz
Algorithm Hash digest
SHA256 7936bc2bfafccf55c4b6050db5788a466fc0a7da15b1f89baaa7506c76cf3bbf
MD5 83cef1231c364768eafde30eeb414454
BLAKE2b-256 b12bfb98f03c09d961e1186dc22bd5f6be200bb951636f49c12fffd7508e9074

See more details on using hashes here.

File details

Details for the file diff_tweezers-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: diff_tweezers-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for diff_tweezers-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 46f57755e3cb0d57cb1a0ac5752e51d43590c724f7cc38b6061ba4eeb810f3a1
MD5 88ab3840d5c3e8499838a67b1d7e5f92
BLAKE2b-256 c253bb22b4a1960b8e1d65bd34d09dc2b114f8c7853d2a0369db777ce213add0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page