Expand description
Switch, create, and derive Git branches (including from GitHub PR URLs).
ยงArguments
-Switch to previous branch.-b <args...>Create new branch from sanitized<args...>then switch.<single>Switch if exists, else confirm create & switch.<multiple args>Sanitize & join into branch name (create if missing).<github pull request url>Derive branch name from PR & switch (fetch if needed).- (none) Launch interactive selector.
ยงUsage
gcu # interactive branch picker
gcu - # previous branch
gcu -b Feature Add Foo # create: feature-add-foo
gcu feature add foo # sanitized join -> feature-add-foo (create if missing)
gcu https://github.com/org/repo/pull/123 # derive PR branch name & switchยงErrors
- GitHub authentication via [
ytil_gh::log_into_github] or PR branch name derivation via [ytil_gh::get_branch_name_from_url] fails. - Branch name construction via
build_branch_nameyields empty string. - Branch listing via [
ytil_git::branch::get_all] / switching via [ytil_git::branch::switch] / creation via [ytil_git::branch::create_from_default_branch] fails. - Interactive selection via [
ytil_tui::minimal_select] or user confirmation input fails. - Current branch lookup via [
ytil_git::branch::get_current] fails.
Functionsยง
- ask_
branching_ ๐from_ not_ default - Prints a styled notice that a new branch is being created from a non-default branch.
- autocomplete_
git_ ๐branches_ and_ switch - Interactive selection and switching of Git branches.
- build_
branch_ ๐name - Builds a sanitized, lowercased Git branch name from raw arguments.
- create_
branch_ ๐and_ switch - Creates a new local branch (if desired) and switches to it.
- handle_
single_ ๐input_ argument - Handles a single input argument, either a GitHub PR URL or a branch name, and switches to the corresponding branch.
- main ๐
- Switch, create, and derive Git branches (including from GitHub PR URLs).
- report_
branch_ ๐exists - Prints a styled indication that the branch already exists; then indicates switch.
- report_
branch_ ๐new - Prints a styled indication that a new branch was created.
- report_
branch_ ๐not_ created - Prints a styled indication that branch creation was aborted (no newline).
- report_
branch_ ๐switch - Prints a styled indication of a successful branch switch.
- should_
create_ ๐new_ branch - Returns
trueif a new branch may be created following the desired behavior.