# guh CLI — Command Reference ## Table of Contents - [`guh`](#guh) - [`account`](#account) - [`account save`](#account-save) - [`account switch`](#account-switch) - [`branch`](#branch) - [`branch create`](#branch-create) - [`branch switch`](#branch-switch) - [`branch rename`](#branch-rename) - [`browse`](#browse) - [`browse issues`](#browse-issues) - [`browse pr`](#browse-pr) - [`commit`](#commit) - [`diff`](#diff) - [`init`](#init) - [`link`](#link) - [`link add`](#link-add) - [`link remove`](#link-remove) - [`logs`](#logs) - [`pull`](#pull) - [`push`](#push) - [`stash`](#stash) - [`undo`](#undo) --- ## `guh` Root command. Prints a welcome message when run without a subcommand. ``` guh > Welcome to guh! Use --help to see available commands. ``` --- ## `account` ### `account save` Save a new account with username, email, classic token, and platform. ``` guh account save ``` All four values are required and must be non-empty. `platform` is the Git provider domain (e.g. `github.com`). Credentials are stored in the user config directory under `dev.pages.codedave.guh/accounts.json`. ### `account switch` Switch to a saved account (updates global git config and credentials). ``` guh account switch ``` Sets `credential.helper` to `store`, updates `user.name` and `user.email` in global git config, and overwrites `~/.git-credentials` with the stored token. The account must have been saved with `guh account save` first. --- ## `branch` ### `branch create` Create and switch to a new branch. ``` guh branch create ``` Equivalent to `git switch -c `. ### `branch switch` Switch to an existing branch, or list branches. ``` guh branch switch guh branch switch list ``` Equivalent to `git switch `. Using `list` is equivalent to `git branch`. ### `branch rename` Rename the current branch. ``` guh branch rename ``` Equivalent to `git branch -m `. --- ## `browse` Open the repository's remote origin in the default browser. ``` guh browse ``` Equivalent to opening the repo URL (without `.git` suffix) in a browser. ### `browse issues` Open the issues page. ``` guh browse issues ``` ### `browse pr` Open the pull requests page. ``` guh browse pr ``` Optionally, add `print` to print the URL instead of opening it. ``` guh browse issues print guh browse pr print guh browse print ``` --- ## `commit` Add files and commit changes. Shows `git status --short` before committing. Optionally pushes after commit. ``` guh commit # show edited files only guh commit "." "message" # git add . && commit guh commit '["file1", "file2"]' "message" # add specific files && commit guh commit '["file1"]' "message" "description" # commit with message + description guh commit '["file1"]' "message" push # commit + push to origin guh commit '["file1"]' "message" "description" push # commit + push to origin guh commit '["file1"]' "message" push "upstream" # commit + push to named remote guh commit '["file1"]' "message" "description" push "all" # commit + push to all remotes ``` **Arguments** | # | Name | Required | Description | |---|------|----------|-------------| | 1 | files | yes* | JSON array of files, or `"."` to add everything | | 2 | message | yes* | Commit message | | 3 | description | no | Optional commit description (uses `-m` twice) | | 4 | push | no | Literal `"push"` to trigger a push after commit | | 5 | remote | no | Remote name (default `"origin"`; use `"all"` to push to all remotes) | \*When no arguments are given, shows `git status --short` instead. --- ## `diff` Show working tree changes. ``` guh diff # show all working tree changes guh diff # show changes for a specific file ``` Equivalent to `git diff [file]`. --- ## `init` Initialize a new Git repository in the current directory. ``` guh init ``` Equivalent to `git init`. --- ## `link` Show remote URLs or add/remove remotes. ``` guh link # show all remotes (git remote -v) guh link add # add (or replace) a remote guh link remove # remove a remote ``` ### `link add` Set a remote URL. Removes any existing remote with the same name first, then adds it. Requires exactly 2 arguments: remote name and URL. ``` guh link add ``` ### `link remove` Remove a remote by name. Requires exactly 1 argument: the remote name. ``` guh link remove ``` --- ## `logs` Show commit logs. ``` guh logs [commits] ``` **Arguments** | # | Name | Required | Description | |---|------|----------|-------------| | 1 | commits | no | Number of commits to show (default: all commits) | Examples: ``` guh logs # git log (full history) guh logs 5 # git log -5 (last 5 commits) ``` --- ## `pull` Fetch and pull upstream changes. ``` guh pull ``` Runs `git fetch` followed by `git pull`. --- ## `push` Push the current branch to a remote. Uses `-u` to set upstream tracking automatically. ``` guh push # git push -u origin guh push # git push -u guh push all # push to all remotes ``` When `all` is given, pushes to every remote returned by `git remote`. The first remote uses `-u` and the current branch name to set upstream tracking; subsequent remotes are pushed without the `-u` flag. **Arguments** | # | Name | Required | Description | |---|------|----------|-------------| | 1 | remote | no | Remote name, or `"all"` to push to every remote (default: `"origin"`) | --- ## `stash` Stash current working directory changes. ``` guh stash ``` Equivalent to `git stash`. --- ## `undo` Undo local commits using `git reset`. Flavour defaults to `soft` for unrecognized values. ``` guh undo [flavour] ``` **Arguments** | # | Name | Required | Description | |---|------|----------|-------------| | 1 | commits | yes | Number of commits to go back (e.g. `1`) | | 2 | flavour | no | Reset mode: `hard`, `mixed` (default: `soft`) | Examples: ``` guh undo 1 # git reset --soft HEAD~1 guh undo 2 hard # git reset --hard HEAD~2 guh undo 1 mixed # git reset --mixed HEAD~1 ```