Skip to main content
gx init creates the .git/gx/stack.json configuration file that tracks branch relationships for stacking. This is optional — most stacking commands auto-initialize when needed.

Usage

Flags

Example

Re-initialize

Use --force to change the trunk branch without losing tracked relationships:

Auto-initialization

You do not need to run gx init before using stacking commands. When you run gx stack for the first time, gx auto-creates the config with the detected HEAD branch as trunk. Running gx init when already initialized shows the current state:
Use --trunk if your repo uses a non-standard default branch name (e.g., develop, production) that git does not report as the HEAD branch.
The stack config is stored at .git/gx/stack.json inside the repo’s git directory. It is not tracked by git and does not appear in your working tree. This means it is local to each clone — collaborators each have their own stack config.