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.

Cherry-pick revert hunks from a commit:

tweezers --revert
tweezers --revert <commit>
tweezers --revert feature-branch

Select hunks to revert 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 Cherry-pick revert hunks from HEAD to working tree
--revert 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
s Split chunk at context boundaries
l / Unfold
h / Fold
] / } 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.1.tar.gz (14.5 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.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: diff_tweezers-0.3.1.tar.gz
  • Upload date:
  • Size: 14.5 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.1.tar.gz
Algorithm Hash digest
SHA256 dcdfa8c0139fc662b4cb4bbf857fe0b3220e84bbfe93f028631f9a3b5a60606d
MD5 6ad51438225ed276238672cfae6e6489
BLAKE2b-256 618665f1bcf10aec138e29d0f0fa573ad8328a70855d91fae0cf465ef07d385d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: diff_tweezers-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf43d78c588f05211ae9e1c6aaf5f5ffa7883f281461491b8739eceae1843f37
MD5 80d94cd120269a83996e89b088447d64
BLAKE2b-256 9cbc86668d2e90d595326ae3088fd7bfd10b761454519b51d9090f2d99c4ed25

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