git-pincer 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -16
- package/bin/git-pincer.js +0 -7
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -2,16 +2,23 @@
|
|
|
2
2
|
<img src="./assets/logo.gif" width="320" alt="git-pincer logo">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<h1 align="center">git-pincer</h1>
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://github.com/zlx2019/git-pincer/actions/workflows/ci.yml"><img src="https://github.com/zlx2019/git-pincer/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
|
|
9
|
+
<a href="https://crates.io/crates/git-pincer"><img src="https://img.shields.io/crates/v/git-pincer.svg" alt="crates.io" /></a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/git-pincer"><img src="https://img.shields.io/npm/v/git-pincer.svg" alt="npm" /></a>
|
|
11
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT" /></a>
|
|
12
|
+
<a href="https://www.rust-lang.org"><img src="https://img.shields.io/badge/rust-1.96.0%2B-orange.svg" alt="Rust" /></a>
|
|
13
|
+
</p>
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
<p align="center">
|
|
16
|
+
<b>English</b> · <a href="./README.zh-CN.md">简体中文</a>
|
|
17
|
+
</p>
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
<p align="center">
|
|
20
|
+
<b>"Pincer"</b> — a Git terminal tool written in Rust, focused on helping developers resolve code conflicts in Git merge, rebase, cherry-pick and similar scenarios with ease.
|
|
21
|
+
</p>
|
|
15
22
|
|
|
16
23
|
The name comes from Rust's mascot — the crab. A Git conflict is like two branches "pinching" the same piece of code at the same time, while a crab's pincer stands for stability, precision and control. May it work like a trusty pincer: gripping both sides of every conflict firmly, helping you understand the differences and complete the merge more efficiently.
|
|
17
24
|
|
|
@@ -19,14 +26,14 @@ The name comes from Rust's mascot — the crab. A Git conflict is like two branc
|
|
|
19
26
|
|
|
20
27
|
## Features
|
|
21
28
|
|
|
22
|
-
- **Three-pane merge UI** — local | result | remote, with
|
|
23
|
-
- **Precise diff rendering** — delta-style word-level emphasis inside changed chunks, plus syntax highlighting
|
|
24
|
-
- **Full flow takeover** —
|
|
25
|
-
- **RPG-style action menu** —
|
|
26
|
-
- **Broad conflict-source support** — merge, rebase, pull, cherry-pick, revert, `git am`, and
|
|
27
|
-
- **Native git, zero magic** —
|
|
28
|
-
- **Terminal-aware theming** — dark (Tokyo Night) and light (Maple Light) themes via `--theme <auto|dark|light>`, `COLORFGBG` auto-detection, and
|
|
29
|
-
- **Bilingual UI** —
|
|
29
|
+
- **Three-pane merge UI** — local | result | remote, with chunks colored like IDEA: blue = modified, green = added, gray = deleted, red = conflict. The color fades once a chunk is resolved.
|
|
30
|
+
- **Precise diff rendering** — delta-style word-level emphasis inside changed chunks, plus syntax highlighting chosen by file extension (turned off for huge files).
|
|
31
|
+
- **Full flow takeover** — once every file is resolved it runs `git add` and the matching `--continue`, then re-checks and repeats until the repository is clean, so multi-commit cherry-picks and multi-round rebases just work.
|
|
32
|
+
- **RPG-style action menu** — bare `git-pincer` in a clean repository opens a pixel-art menu: pick an action, then a branch (merge / rebase / switch) or a commit (cherry-pick / revert). A status window maps your repository to character stats (Lv. = commits, HP = uncommitted changes, MP = stashes, EXP = commits ahead), and results appear as in-TUI dialogs — no flicker, no exit.
|
|
33
|
+
- **Broad conflict-source support** — merge, rebase, pull, cherry-pick, revert, `git am`, and flows without a `--continue` such as `stash pop`, `checkout -m` or `apply --3way`.
|
|
34
|
+
- **Native git, zero magic** — shells out to your git binary (the route lazygit and IDEA take), so credentials, hooks, merge strategies and rerere follow your existing configuration. Arguments are passed as arrays (no shell) and host `GIT_DIR`-style variables are scrubbed, so nested calls from hooks can't hit the wrong repository.
|
|
35
|
+
- **Terminal-aware theming** — dark (Tokyo Night) and light (Maple Light) themes via `--theme <auto|dark|light>`, `COLORFGBG` auto-detection, and xterm-256 quantization on terminals without truecolor.
|
|
36
|
+
- **Bilingual UI** — English and Chinese, chosen with `--lang <auto|zh|en>` (`auto` follows the system locale). Messages are embedded at compile time, so it is still a single binary.
|
|
30
37
|
- **Sensible fallbacks** — binary conflicts degrade to whole-file pick-one; a git-free `file` mode parses conflict markers directly; non-TTY invocations fail with a readable message instead of a panic.
|
|
31
38
|
|
|
32
39
|
## Installation
|
|
@@ -37,6 +44,12 @@ Requires `git` on your `PATH`.
|
|
|
37
44
|
cargo install git-pincer
|
|
38
45
|
```
|
|
39
46
|
|
|
47
|
+
Or via npm (prebuilt binary, no Rust toolchain needed):
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install -g git-pincer
|
|
51
|
+
```
|
|
52
|
+
|
|
40
53
|
Prebuilt binaries for major platforms are also attached to [GitHub Releases](https://github.com/zlx2019/git-pincer/releases). To build from source (Rust 1.96+):
|
|
41
54
|
|
|
42
55
|
```bash
|
|
@@ -53,6 +66,7 @@ git-pincer rebase <branch> # run git rebase, looping through every conflict
|
|
|
53
66
|
git-pincer pull origin main # arguments are passed straight to git pull
|
|
54
67
|
git-pincer cherry-pick <commit> # multiple commits / options are passed through
|
|
55
68
|
git-pincer revert <commit> # run git revert and take over the conflicts
|
|
69
|
+
git-pincer switch [branch] # switch branches; remote ones get a local tracking branch (no arg opens a picker)
|
|
56
70
|
git-pincer file conflict.txt # git-free: parse a conflict-marked file, write it back
|
|
57
71
|
git-pincer abort # abort the operation in progress (with confirmation)
|
|
58
72
|
git-pincer completions zsh # shell completion script (bash/zsh/fish/powershell/elvish)
|
|
@@ -98,7 +112,7 @@ rpg_accent = "#ff7a2f"
|
|
|
98
112
|
band_conflict = ["#3a1e22", "#5e2d35"] # band_* / emph_* colors take a [normal, selected] pair
|
|
99
113
|
```
|
|
100
114
|
|
|
101
|
-
Rebindable actions: `take-local`, `take-remote`, `ignore`, `undo`, `undo-file`, `edit`, `apply-all`, `next-change`, `prev-change`, `next-conflict`, `prev-conflict`, `copy-chunk`, `copy-file`, `copy-local`, `copy-remote`, `write`, `next-file`, `fold`, `quit`, `help`. Overridden keys show up in the hint bar and help overlay automatically. Unknown action names, key conflicts and invalid colors are rejected at startup with the full list of valid values.
|
|
115
|
+
Rebindable actions: `take-local`, `take-remote`, `ignore`, `undo`, `undo-file`, `edit`, `apply-all`, `next-change`, `prev-change`, `next-conflict`, `prev-conflict`, `scroll-down`, `scroll-up`, `scroll-left`, `scroll-right`, `copy-chunk`, `copy-file`, `copy-local`, `copy-remote`, `write`, `next-file`, `fold`, `quit`, `help`. Overridden keys show up in the hint bar and help overlay automatically. Unknown action names, key conflicts and invalid colors are rejected at startup with the full list of valid values.
|
|
102
116
|
|
|
103
117
|
Try the TUI without a git repository:
|
|
104
118
|
|
|
@@ -120,6 +134,7 @@ cp fixtures/conflict.txt /tmp/ && git-pincer file /tmp/conflict.txt
|
|
|
120
134
|
| `j` / `k` | Move to the next / previous change chunk |
|
|
121
135
|
| `n` / `p` | Jump to the next / previous unresolved conflict |
|
|
122
136
|
| `Ctrl+d` / `Ctrl+u` | Scroll the viewport half a page down / up (navigation keys re-attach it to the cursor) |
|
|
137
|
+
| `<` / `>` (or `Shift+←` / `Shift+→`) | Pan all three panes left / right on long lines (`…` marks clipped content) |
|
|
123
138
|
| `y` / `Y` | Copy the current chunk result / the whole file result |
|
|
124
139
|
| `H` / `L` | Copy the local / remote side of the current chunk |
|
|
125
140
|
| `w` | Write the file (auto-applies remaining non-conflict changes, then `git add`) |
|
package/bin/git-pincer.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
// git-pincer 的 npm 启动垫片:
|
|
5
|
-
// 按当前平台定位 optionalDependencies 里对应的二进制子包, 并把参数原样转发给它。
|
|
6
|
-
|
|
7
4
|
const { spawnSync } = require("node:child_process");
|
|
8
5
|
const path = require("node:path");
|
|
9
6
|
|
|
10
|
-
// 判断 Linux 是否为 musl 环境(运行时报告中没有 glibc 版本信息即视为 musl)
|
|
11
7
|
function isMusl() {
|
|
12
8
|
try {
|
|
13
9
|
return !process.report.getReport().header.glibcVersionRuntime;
|
|
@@ -16,7 +12,6 @@ function isMusl() {
|
|
|
16
12
|
}
|
|
17
13
|
}
|
|
18
14
|
|
|
19
|
-
// 根据平台与架构推导对应的二进制子包名, 不支持的平台返回 null
|
|
20
15
|
function platformPackage() {
|
|
21
16
|
const { platform, arch } = process;
|
|
22
17
|
if (platform === "darwin" && arch === "arm64") return "@zero9501/git-pincer-darwin-arm64";
|
|
@@ -29,7 +24,6 @@ function platformPackage() {
|
|
|
29
24
|
return null;
|
|
30
25
|
}
|
|
31
26
|
|
|
32
|
-
// 定位子包内的可执行文件绝对路径, 失败时输出指引并退出
|
|
33
27
|
function binaryPath() {
|
|
34
28
|
const pkg = platformPackage();
|
|
35
29
|
if (!pkg) {
|
|
@@ -52,7 +46,6 @@ if (result.error) {
|
|
|
52
46
|
process.exit(1);
|
|
53
47
|
}
|
|
54
48
|
if (result.signal) {
|
|
55
|
-
// 被信号终止时对自身重放同一信号, 让退出码符合 shell 约定(128+N)
|
|
56
49
|
process.kill(process.pid, result.signal);
|
|
57
50
|
}
|
|
58
51
|
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-pincer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "A simple and efficient terminal Git conflict resolution CLI tool.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"git",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"node": ">=16"
|
|
28
28
|
},
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@zero9501/git-pincer-darwin-arm64": "0.1.
|
|
31
|
-
"@zero9501/git-pincer-darwin-x64": "0.1.
|
|
32
|
-
"@zero9501/git-pincer-linux-arm64-gnu": "0.1.
|
|
33
|
-
"@zero9501/git-pincer-linux-x64-gnu": "0.1.
|
|
34
|
-
"@zero9501/git-pincer-linux-x64-musl": "0.1.
|
|
35
|
-
"@zero9501/git-pincer-win32-x64": "0.1.
|
|
30
|
+
"@zero9501/git-pincer-darwin-arm64": "0.1.5",
|
|
31
|
+
"@zero9501/git-pincer-darwin-x64": "0.1.5",
|
|
32
|
+
"@zero9501/git-pincer-linux-arm64-gnu": "0.1.5",
|
|
33
|
+
"@zero9501/git-pincer-linux-x64-gnu": "0.1.5",
|
|
34
|
+
"@zero9501/git-pincer-linux-x64-musl": "0.1.5",
|
|
35
|
+
"@zero9501/git-pincer-win32-x64": "0.1.5"
|
|
36
36
|
}
|
|
37
37
|
}
|