@kaynooo/cli-git 0.15.0 → 0.16.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 +44 -1
- package/dist/gb.js +311 -73
- package/dist/gc.js +130 -46
- package/dist/gcl.js +1700 -0
- package/dist/gd.js +1680 -0
- package/dist/gf.js +1662 -0
- package/dist/gm.js +2885 -0
- package/dist/gp.js +142 -63
- package/dist/gst.js +183 -68
- package/dist/gu.js +1523 -0
- package/package.json +16 -6
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# gst, gc, gb and
|
|
1
|
+
# gst, gc, gb, gp, gf, gm, gcl, gd and gu
|
|
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
|
|
|
@@ -42,6 +42,49 @@ Prints one line with the branch, its upstream and how far ahead and behind it is
|
|
|
42
42
|
- 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 `--fetch` what ctrl-r runs.
|
|
43
43
|
- Exit codes: the git command's, 1 when no branch is picked or found, 2 outside a repository.
|
|
44
44
|
|
|
45
|
+
## gf
|
|
46
|
+
|
|
47
|
+
`gf [dir]...` fetches with prune, then fast-forwards the current branch onto its upstream, and prints what came in (`main <- origin/main, 2 commits`). `--repos` (`-r`) does every repository `gst --repos` lists; `--no-pull` fetches only and says how far behind the branch is.
|
|
48
|
+
|
|
49
|
+
- It never merges or rebases: a branch that has diverged, or a working tree the fast-forward would overwrite, is refused and left as it was, with git's reason.
|
|
50
|
+
- A detached HEAD, a branch with no upstream and one whose upstream is gone are fetched only, saying so.
|
|
51
|
+
- `--json` prints `{path, branch, upstream, commits, outcome, reason?}` per repository, `outcome` being `updated`, `current`, `fetched`, `skipped` or `refused`.
|
|
52
|
+
- Exit codes: 0 every repository was fetched, and fast-forwarded when it could be, 1 a fetch failed, a branch diverged or a fast-forward was refused, 2 outside a repository or a usage error.
|
|
53
|
+
|
|
54
|
+
## gm
|
|
55
|
+
|
|
56
|
+
`gm <branch>` merges the branch into the current one with `git merge --no-edit` and prints what came in: fast-forward or merge commit, the commits and the files changed. A working tree with uncommitted changes is refused.
|
|
57
|
+
|
|
58
|
+
- On a conflict every conflicted file is listed with its conflict regions (the markers and two lines around them, line numbers included) and the exit is 1; `gm --continue` commits once the markers are gone, refusing while one remains, and `gm --abort` gives the merge up.
|
|
59
|
+
- `gm --dry-run <branch>` says whether the merge would conflict, and in which files, with `git merge-tree` and nothing touched.
|
|
60
|
+
- `--squash` stages the branch's changes without committing them, to commit with `gc`.
|
|
61
|
+
- With no branch, a terminal gets a picker of the other branches (ahead and behind the current one, a preview of the commits, files and verdict; enter merges, ctrl-s squashes); without a terminal the branches are listed with their verdict, `--json` giving `[{name, ahead, behind, outcome, conflicts}]`.
|
|
62
|
+
- Exit codes: 0 merged, already merged or no conflict in a dry run, 1 a conflict, a dirty tree or a refusal, 2 outside a repository or a usage error.
|
|
63
|
+
|
|
64
|
+
## gcl
|
|
65
|
+
|
|
66
|
+
`gcl <repo> [dir]` clones into `<workspace>/<name>` (the workspace `cli config` reports) or into `dir`, and prints the path on stdout, so `cd (gcl kaynooo/cli)` lands in it. `<repo>` is a URL, an scp-style address, a local path or `owner/name`, read as `https://git.kaynooo.fr/owner/name.git`; the `forge` key of `~/.config/kaynooo-cli/config.json` names another host.
|
|
67
|
+
|
|
68
|
+
- A folder that already holds the repository is not cloned again: it is fetched and fast-forwarded as `gf` does. A folder holding anything else is refused, exit 1.
|
|
69
|
+
- `--json` prints `{url, path, branch, head, outcome}`, `outcome` being `cloned` or `existing`.
|
|
70
|
+
|
|
71
|
+
## gd
|
|
72
|
+
|
|
73
|
+
`gd [path]...` lists the tracked files that changed with their added and removed lines, staged apart from unstaged; untracked files are `gst`'s. With paths, or `--patch` (`-p`), it prints the patch instead, through `view --diff` on a terminal when `view` is installed.
|
|
74
|
+
|
|
75
|
+
- `--staged` (`-s`) keeps what is staged; `--ref <rev>` compares the working tree to a commit, branch or tag, and `--ref a..b` two commits.
|
|
76
|
+
- `--json` prints `[{title, files: [{path, added, removed}]}]`, the counts being null for a binary file.
|
|
77
|
+
- Exit codes: 0, 1 git refused (an unknown ref), 2 outside a repository or a usage error.
|
|
78
|
+
|
|
79
|
+
## gu
|
|
80
|
+
|
|
81
|
+
`gu <path>...` undoes changes and keeps what it takes away.
|
|
82
|
+
|
|
83
|
+
- By default it discards the unstaged changes of the paths, after saving them as a patch in the git folder (`gu/<time>.patch`); `git apply` puts them back. Without a path it is a usage error, never "everything".
|
|
84
|
+
- `--staged` unstages the paths, the working tree untouched.
|
|
85
|
+
- `--commit` undoes the last commit, its changes left staged (the commit stays in the reflog). It refuses a commit the upstream already holds, a merge and the first commit.
|
|
86
|
+
- Exit codes: 0, 1 a path with no change or a commit refused, 2 a usage error or outside a repository.
|
|
87
|
+
|
|
45
88
|
## Library
|
|
46
89
|
|
|
47
90
|
`@kaynooo/cli-git/message` exports `commitMessageViolation(message)`, the rule a message breaks as the sentence to show or null, and the rule sentences, for the guard that checks a `git commit` typed by hand.
|