Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions scripts/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* branch <name> b <name> checkout -b -> add -> commit -> push -u
* merge <src> [dst] m <src> [d] add -> commit -> checkout dst -> merge -> push
* save s add -> commit -> checkout main
* switch <branch> sw <branch> checkout <branch>
* checkout <branch> ck <branch> git checkout <branch> (sw alias)
* remote <url> r <url> init -> remote add origin -> first push
* restore [file] rs [file] git restore . (or one file) — destructive
* model [slug] mo [slug] show or switch the AI model
Expand Down Expand Up @@ -741,6 +741,8 @@ const SHORT_CMDS: Record<string, string> = {
b: "branch",
m: "merge",
s: "save",
ck: "switch",
checkout: "switch",
sw: "switch",
r: "remote",
rs: "restore",
Expand Down Expand Up @@ -1038,7 +1040,7 @@ function helpText(): string {
["branch <name> [-m]", "b <name> [-m]", "new branch → add → commit → push -u"],
["merge <src> [dst] [-m]", "m <src> [dst]", "commit → checkout dst|main → merge → push"],
["save [-m]", "s [-m]", "commit current work, then checkout main"],
["switch <branch>", "sw <branch>", "checkout <branch>"],
["checkout <branch>", "ck <branch>", "git checkout <branch>"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The sw alias is silently dropped from the displayed help table. It still resolves at runtime (via SHORT_CMDS), so existing users or scripts that call gg sw <branch> keep working — but there's no indication in the help output that sw is still accepted. Adding it as a secondary note avoids surprising users who are familiar with the old alias.

Suggested change
["checkout <branch>", "ck <branch>", "git checkout <branch>"],
["checkout <branch>", "ck <branch>", "git checkout <branch> (sw alias still works)"],
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/cli.ts
Line: 1043

Comment:
The `sw` alias is silently dropped from the displayed help table. It still resolves at runtime (via `SHORT_CMDS`), so existing users or scripts that call `gg sw <branch>` keep working — but there's no indication in the help output that `sw` is still accepted. Adding it as a secondary note avoids surprising users who are familiar with the old alias.

```suggestion
    ["checkout <branch>", "ck <branch>", "git checkout <branch>  (sw alias still works)"],
```

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

["remote <url> [-m]", "r <url> [-m]", "git init → remote add origin → first push"],
["restore [file] [-y]", "rs [file] [-y]", "discard changes (all, or one file)"],
["model [slug]", "mo [slug]", "show or switch the AI model"],
Expand Down Expand Up @@ -1237,8 +1239,8 @@ async function main() {

case "switch": {
const target = arg1;
if (!target) die('branch name required — e.g. gg sw main (or gitgen switch main)');
banner(`switch to ${target}`);
if (!target) die('branch name required — e.g. gg ck main (or gitgen checkout main)');
banner(`checkout ${target}`);
await runSteps(async () => {
await git(["checkout", target]);
});
Expand Down
Loading