@kaynooo/cli-git 0.5.2 → 0.7.0
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 +13 -4
- package/dist/gb.js +1273 -0
- package/dist/gc.js +89 -45
- package/dist/gst.js +74 -42
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# gst and
|
|
1
|
+
# gst, gc and gb
|
|
2
2
|
|
|
3
3
|
Git for Claude Code, where a session would otherwise chain `git status --short` and `git log --oneline` to read the state, or `git add <paths> && git status && git commit -m ...` to commit and have the commit bounced over its message.
|
|
4
4
|
|
|
@@ -10,17 +10,26 @@ gc 'fix(band): keep it visible' -m 'The band stays above a long prompt.' --ticke
|
|
|
10
10
|
|
|
11
11
|
## gst
|
|
12
12
|
|
|
13
|
-
Prints one line with the branch, its upstream and how far ahead and behind it is as of the last fetch, the counts of changed, untracked and conflicted files and HEAD, then the paths grouped as `staged`, `unstaged`, `untracked` and `conflicted`, each with git's letter (`M`, `A`, `D`, `R old -> new`). `--log N` adds the last N commits as `<sha7> <title>`. `--json` prints the same as `{branch, oid, upstream, ahead, behind, head, staged, unstaged, untracked, conflicted, commits}`, a change as `{status, path, from?}`. It takes no index lock, so it runs beside another git command. Exit codes: 0,
|
|
13
|
+
Prints one line with the branch, its upstream and how far ahead and behind it is as of the last fetch, the counts of changed, untracked and conflicted files and HEAD, then the paths grouped as `staged`, `unstaged`, `untracked` and `conflicted`, each with git's letter (`M`, `A`, `D`, `R old -> new`). `--log N` adds the last N commits as `<sha7> <title>`. `--json` prints the same as `{branch, oid, upstream, ahead, behind, head, staged, unstaged, untracked, conflicted, commits}`, a change as `{status, path, from?}`. It takes no index lock, so it runs beside another git command. Exit codes: 0, 2 outside a repository or a usage error.
|
|
14
14
|
|
|
15
15
|
## gc
|
|
16
16
|
|
|
17
|
-
`gc <title> [-m <line>]... [--ticket <line>]... -- <path>...` commits exactly the paths given and prints `<sha7> <title>` then each file committed with its letter
|
|
17
|
+
`gc <title> [-m <line>]... [--ticket <line>]... -- <path>...` commits exactly the paths given and prints `<sha7> <title>` then each file committed with its letter; `--json` prints `{sha, subject, files: [{status, path, from?}]}`.
|
|
18
18
|
|
|
19
19
|
- The message is the title, then the `-m` lines, then the `--ticket` lines, each block after a blank line; ticket lines are copied verbatim and read `#<n> - <title>`.
|
|
20
20
|
- Before anything is staged it refuses, exit 1, saying which rule broke: a title that is no Conventional Commit, a title over one line, more than two description lines, a bullet list, a hard-wrapped sentence, any trailer (`Co-Authored-By`, `Signed-off-by`, "Generated with"). A breaking change (`feat!:` or a `BREAKING CHANGE:` line) may give full details.
|
|
21
21
|
- It also refuses, with nothing staged, a path with no change (unchanged, ignored or missing) and an index already holding files beyond the given paths, which the commit would carry along.
|
|
22
22
|
- A path may be a directory or a deleted file. When git refuses the commit (a hook), the paths are unstaged again and git's output is shown.
|
|
23
|
-
- Exit codes: 0 committed, 1 refused, 2 a usage error.
|
|
23
|
+
- Exit codes: 0 committed, 1 refused, 2 a usage error or outside a git repository.
|
|
24
|
+
|
|
25
|
+
## gb
|
|
26
|
+
|
|
27
|
+
`gb [branch]` picks a git branch with fzf and switches to it: the branches last checked out first (from the reflog), then the other local ones, then the remote ones with no local branch yet. The header says where HEAD stands, each row how its branch stands against its upstream and whether it is merged into the base. Keys: enter switches (a remote branch gets its tracking branch), ctrl-n creates a branch named after the query, ctrl-d deletes the highlighted local branch with `git branch -d`, ctrl-r fetches and prunes. Without fzf or a terminal it lists the branches, as JSON with `--json`.
|
|
28
|
+
|
|
29
|
+
- `gb <branch>` switches without the picker, a bare name finding the remote branch it would create; `gb -` goes back, `gb -c <name>` creates a branch, `gb -d <branch>` deletes a local one.
|
|
30
|
+
- A branch checked out in another worktree needs a `cd`, which a command cannot do for its shell: `gb` prints the worktree's path on stdout and a hint on stderr.
|
|
31
|
+
- Hidden flags for wrappers: `--emit` (with any of the above) prints the command as lines for a shell function to run, `--list` the rows as JSON for term, `--names` the branches with their last commit for shell completions, `--show <branch>` the preview and `--rows`, `--fetch` what ctrl-r reloads.
|
|
32
|
+
- Exit codes: the git command's, 1 when no branch is picked or found, 2 outside a repository.
|
|
24
33
|
|
|
25
34
|
## Library
|
|
26
35
|
|