gx drift shows exactly how many commits your branch is ahead and behind a target branch, with a list of the divergent commits and a file stat summary.
Usage
Arguments
| Argument | Description |
|---|---|
target | Branch to compare against (default: HEAD branch, i.e., main/master) |
Flags
| Flag | Short | Description |
|---|---|---|
--full | Show all commits without truncation | |
--parent | -p | Compare against the stack parent instead of the HEAD branch |
Example Output
Using with Stacked Branches
The--parent flag compares against the stack parent instead of main. This is useful when working with stacked PRs where you want to see drift relative to the parent branch, not trunk:
You cannot use
--parent and an explicit target branch at the same time. gx will print an error if you try.Details
Details
- Commits are truncated to 20 per section by default. Use
--fullto see all - If there is no divergence, gx prints
OK No divergence. Your branch is based on the latest <target>. - If you are already on the target branch, gx prints
> You're on <target>. Switch to a feature branch to see drift. - The “Files diverged” line shows the total stat summary from the merge base to HEAD
- If the branch has no common ancestor with the target, gx prints an error