init
Initialize a new integration branch tracking a remote upstream. This is the entry point for starting a git-loom workflow.
Usage
git-loom init [name]
Arguments
| Argument | Description |
|---|---|
[name] | Branch name (optional, defaults to integration) |
What It Does
- Creates a new local branch at the upstream tip
- Configures upstream tracking (e.g.
origin/main) - Switches HEAD to the new branch
All three happen in a single atomic operation.
Upstream Detection
The upstream is resolved automatically in priority order:
- Current branch’s upstream — if you’re on
maintrackingorigin/main, the integration branch will also trackorigin/main - Remote scan — scans all remotes for branches named
main,master, ordevelop - Interactive prompt — if multiple candidates are found, you’re asked to choose
- Error — if no remote tracking branches are found
Examples
Default
git-loom init
# Initialized integration branch 'integration' tracking origin/main
Custom name
git-loom init my-integration
# Initialized integration branch 'my-integration' tracking origin/main
Error: branch already exists
git-loom init
# error: Branch 'integration' already exists
Error: no remotes
git-loom init
# error: No remote tracking branches found.
# Set up a remote with: git remote add origin <url>
Prerequisites
- Must be in a git repository with a working tree
- At least one remote with a fetchable branch must be configured