gx
gx is a command-line tool that runs the git workflows you use every day with safe defaults. One command creates a feature branch, pushes it, pulls with your uncommitted changes kept, or cleans up after a merge. gx shows what it did, asks before risky actions, and can preview each change before it runs.
Features
- Create numbered feature branches, in the current folder or in a separate worktree.
- Push with a warning about uncommitted files and a prompt before a push to the default branch.
- Pull with automatic stash and rebase. If your branch and its upstream both have new commits, gx shows both sides and asks how to combine them.
- Delete merged, gone, and empty branches and their worktrees in one step.
- Show a colored commit log of all branches, with an optional branch graph.
- Show a dashboard of the repository, its branches, its working tree, and its GitHub status.
- Preview any command that changes your repository with
-n(dry run).
Requirements
- Python 3.13 or later.
- git, on your
PATH. - Optional: the GitHub CLI (
gh). Ifghis installed,gx infoshows a GitHub panel andgx doneuses the pull request state to confirm a merge. - Optional: a Nerd Font in your terminal, for host icons on remote branches. See Icons.
Install
Install gx with uv, pipx, or pip:
uv tool install git-gx
pipx install git-gx
pip install git-gx
To install tab completion for your shell, run gx --install-completion and then open a new shell.
Quick start
This example shows the full life of a feature branch:
gx feat # create feat/1 from the newest main and switch to it
# ...edit files and commit...
gx push # push feat/1 to origin and set it to track origin/feat/1
# ...open a pull request; it merges...
gx done # switch to main, delete feat/1, and pull
Run gx with no command inside a repository to see the dashboard.
Commands
| Command | What it does |
|---|---|
gx info |
Show a dashboard of the repository. gx alone does the same. |
gx status |
Show uncommitted changes and a table of active branches. |
gx log |
Show a colored commit log of all branches. |
gx feat |
Create a feature branch from the newest default branch. |
gx push |
Push the current branch and set its upstream. |
gx pull |
Fetch and rebase the current branch, with your changes kept. |
gx integrate |
Bring another branch into the current branch. |
gx clean |
Delete branches and worktrees that you do not need. |
gx done |
Clean up after your pull request merges. |
Every command accepts -h for help. The commands that change the repository (feat, push, pull, integrate, clean, done) accept -n to preview the change without running it. See Options for the options that apply to all commands.
gx info
gx info shows panels for the repository, its branches, the working tree, and the recent commits. If you run gx with no command inside a repository, gx shows this dashboard.
gx info
gx
The dashboard adds these panels when they apply:
- GitHub: if
ghis installed and the remote is on github.com, this panel shows the description, visibility, stars, and the number of open pull requests and issues. - Stashes: if you have stashed changes.
- Worktrees: if the repository has more than one worktree. If a worktree folder was deleted, the panel tells you to run
git worktree prune.
In a repository with no commits, the dashboard shows the repository panel and "No commits yet".
gx status
gx status shows a colored file tree of your uncommitted changes and a table of active branches. The table shows the commits ahead of and behind each upstream, the changed files, and the stashes for each branch.
gx status # file tree and branch table
gx status -F # file tree only
gx status -b # branch table only
gx status -a # include inactive branches in the table
gx log
gx log shows recent commits from all branches in a panel. Badges mark branch tips and tags. Commits that come after your checked-out commit are dim.
gx log # the newest 15 commits
gx log -c 30 # the newest 30 commits
gx log --full # include commit bodies
gx log --graph # branch graph, with long runs of commits folded
gx log --graph --full # branch graph with every commit
gx log --graph -c 20 # the newest 20 commits, with no folding
The graph goes back far enough to show where each local branch starts from the default branch. A long run of commits with no branch or tag folds into one line, for example … 12 more commits on main. If you give -c, the graph shows exactly that number of commits and folds nothing. Each branch except the default branch gets its own color, and a legend under the graph names them.
The graph uses these marks:
| Mark | Meaning |
|---|---|
[name] |
The branch you have checked out. A detached HEAD shows as [HEAD]. |
(name) |
Another local branch. |
origin/name (dim) |
A remote branch. |
◆ name |
A tag. |
↑2 ↓1 |
The branch is 2 commits ahead of and 1 commit behind its upstream. |
⇅ |
The branch matches its upstream. |
↑ after a commit hash |
A commit that you have not pushed. The ASCII style uses +. |
⌂ folder |
The branch is checked out in another worktree. ASCII: wt:folder. |
◌ uncommitted: ... |
Uncommitted changes in that branch. ASCII: o. |
merged, gone (dim) |
The branch is merged, or its upstream was deleted. |
local (in the legend) |
The branch has no upstream. |
Commits that your checkout does not contain are dim, and the subjects of commits on your current branch are bold. If gx clean can delete branches, a line under the legend says how many. That count leaves out empty branches and branches in worktrees with uncommitted changes, because gx clean skips those by default.
gx feat
gx feat creates a branch from the newest default branch and switches to it. Without a name, gx numbers the branches feat/1, feat/2, and so on, and uses the lowest free number. You can change the feat/ prefix in the configuration.
gx feat # create feat/1, or the next free number
gx feat login # create feat/login
gx feat -w # create feat/1 in a worktree at .worktrees/feat/1
gx feat -w ui # create feat/ui in a worktree at .worktrees/feat/ui
gx feat -L # branch from your local default branch, with no fetch
gx fetches the default branch from the remote first, so the branch starts at the newest remote commit. If the repository has no remote with the configured name, gx starts from your local default branch. Use -L to start from your local default branch instead, for example to include commits that you did not push.
With -w, gx creates the branch in its own worktree, so you can work on two branches at the same time without a stash. If the worktree folder is inside the repository, it must be in .gitignore. If it is not, gx stops with an error.
The repository must have at least one commit before you can use gx feat.
gx push
gx push pushes the current branch to its upstream. On the first push, gx pushes to origin/BRANCH and sets it as the upstream.
gx push # push the current branch
gx push -f # force push with --force-with-lease
gx push -t # push the commits and all local tags
gx push --no-verify # push without the pre-push hook
Before it pushes, gx:
- Warns you about uncommitted and untracked files, because the push does not include them.
- Asks you to confirm a push to the default branch.
-fskips this question.
-f uses git push --force-with-lease, not --force. The push fails if the remote branch has commits that you have not fetched, so you cannot overwrite work that you have not seen.
gx pull
gx pull fetches the upstream and rebases the current branch onto it. Your uncommitted changes are kept.
gx pull # fetch and rebase
gx pull --rebase # if the branch diverged, rebase without a prompt
gx pull --merge # if the branch diverged, merge without a prompt
gx pull --ff-only # fast-forward only, and fail if the branch diverged
gx pull --no-verify # if the branch diverged, skip the rebase and merge hooks
gx does these steps:
- Stash your uncommitted changes, including untracked files.
- Fetch from the remote.
- Rebase onto the upstream, or combine the two sides if the branch diverged.
- Update the submodules, if the repository has a
.gitmodulesfile. - Restore your stashed changes.
- Show a summary of the new commits.
A branch has diverged when it and its upstream both have commits that the other does not have. In this case, gx shows the commits on each side and asks whether to rebase or merge. --rebase, --merge, --ff-only, or the integrate.strategy setting answers the question in advance.
If a rebase or merge has a conflict, gx stops with the operation in progress and shows how to continue. Your changes stay in the stash. After you resolve the conflict, run git stash pop to restore them.
If a git hook stops the rebase or merge, gx shows the hook's message. To skip the pre-rebase, pre-merge-commit, and commit-msg hooks, use --no-verify.
gx integrate
gx integrate brings the commits of another branch into the current branch. The short form is gx int.
gx integrate # bring in the upstream
gx integrate main # bring main into the current branch
gx integrate main --merge # merge main in, with no prompt
gx integrate --no-verify # skip the rebase and merge hooks
gx int main -n # preview the result
With no argument, gx uses the upstream of the current branch. You can give a local branch such as main or a remote branch such as origin/main. If the branch is on a remote, gx fetches it first.
The result depends on how the two branches relate:
- If the current branch already has all the commits, gx does nothing.
- If the current branch is only behind, gx fast-forwards it.
- If the branches diverged, gx shows the commits on each side and then rebases or merges. To skip the prompt, use
--rebase,--merge, or--ff-only, or setintegrate.strategy.--ff-onlyfails if the branches diverged.--no-verifyskips thepre-rebase,pre-merge-commit, andcommit-msghooks.
Unlike gx pull, gx integrate does not stash. If you have uncommitted changes, gx stops. Commit or stash them first.
gx clean
gx clean deletes branches and worktrees that you do not need. gx fetches with --prune first, and then finds branches that are:
- Merged into the default branch.
- Gone: the upstream branch was deleted on the remote.
- Empty: the branch has no commits that are not on the default branch.
A merged or empty branch counts only if it has an upstream, so gx clean does not delete local work that you never pushed.
gx clean # show the branches and ask before deleting
gx clean -y # delete with no prompt
gx clean -f # include worktrees with uncommitted changes
gx clean -n # show what gx will delete
gx clean never deletes the current branch, the default branch, or a protected branch (by default main, master, and develop). It skips locked worktrees, and branches that another worktree has checked out. It skips worktrees with uncommitted changes unless you use -f. It also removes the git records of worktrees whose folders you deleted by hand.
gx done
Run gx done after your pull request merges. gx switches to the default branch, deletes the branch you were on, and pulls the default branch.
gx done # clean up after a merged pull request
gx done -f # delete the branch without the merge check
gx done -n # preview the steps
Before it deletes the branch, gx makes sure that the branch merged:
- If
ghreports the pull request as merged, the branch merged. - If
ghhas no pull request for the branch, or is not installed, gx fetches. The branch merged if its upstream was deleted on the remote, or if git reports it as merged into the default branch.
If gx cannot find a merge, it asks you before it deletes the branch. This includes a pull request that gh reports as open or closed. -f skips the merge check.
If you run gx done from a worktree, gx removes the worktree and shows a cd command to go back to the main folder. A worktree with uncommitted changes stops the command, even with -f.
Options
These options apply to all commands:
| Option | Description |
|---|---|
-v |
Show debug output, including each git command that gx runs. |
-vv |
Also show the output of each git command. |
-n, --dry-run |
Show the changes without making them. Commands that change the repository only. gx fetches from the remote first, so the preview uses the current remote branches. |
-h, --help |
Show help for gx or for a command. |
-V, --version |
Show the gx version. |
You can put -v before or after the command: gx -v push and gx push -v do the same.
Configuration
gx needs no configuration. To change its defaults, create ~/.config/gx/config.toml. If XDG_CONFIG_HOME is set to an absolute path, gx reads $XDG_CONFIG_HOME/gx/config.toml instead.
Every key is optional. This example shows every key with its default value:
[branches]
prefix = "feat" # branch prefix for gx feat
protected = ["main", "master", "develop"] # branches that gx clean never deletes
[worktree]
directory = ".worktrees" # base folder for worktrees
[remote]
name = "origin" # remote for gx feat, a first gx push, and pull request lookups
[display]
nerd_font = true # Nerd Font icons for remote branches
graph_style = "auto" # auto, unicode, branch-symbols, or ascii
[integrate]
strategy = "ask" # ask, rebase, merge, or ff-only
Worktree folder
worktree.directory can be a relative or an absolute path:
- gx resolves a relative path, such as
.worktrees, from the top folder of the main checkout, also when you run gx from a linked worktree. - gx uses an absolute path, such as
~/worktrees, as it is.
A worktree folder inside the repository must be in .gitignore.
Integration strategy
integrate.strategy sets what gx pull and gx integrate do when a branch has diverged:
askshows both sides and asks you.rebaseormergeuses that method with no prompt.ff-onlyfails, so you can decide by hand.
Icons
The gx log and gx info panels mark remote branches with Nerd Font icons for the host: GitHub, GitLab, or a general git icon. Most developer terminals have a Nerd Font, so nerd_font is true by default.
If the badges show empty boxes or wrong characters, your terminal font does not have the icons. Set nerd_font = false. gx then uses @ for remotes in the log, and only the remote name in the graph.
graph_style sets the characters that draw the lines in gx log --graph:
autousesunicodeif the terminal uses UTF-8, andasciiif it does not.branch-symbolsuses symbols that the kitty terminal draws, in kitty 0.36 or later. Other terminals show empty boxes.
graph_style does not depend on nerd_font, because Nerd Fonts do not include the branch symbols.
Environment variables
An environment variable overrides the matching setting for one command. Environment variables take priority over the configuration file.
| Variable | Setting | Example |
|---|---|---|
GX_BRANCH_PREFIX |
branches.prefix |
GX_BRANCH_PREFIX=fix gx feat |
GX_PROTECTED_BRANCHES |
branches.protected |
GX_PROTECTED_BRANCHES=main,production gx clean |
GX_WORKTREE_DIRECTORY |
worktree.directory |
GX_WORKTREE_DIRECTORY=~/wt gx feat -w |
GX_REMOTE_NAME |
remote.name |
GX_REMOTE_NAME=upstream gx push |
GX_NERD_FONT |
display.nerd_font |
GX_NERD_FONT=false gx log |
GX_GRAPH_STYLE |
display.graph_style |
GX_GRAPH_STYLE=ascii gx log --graph |
GX_INTEGRATE_STRATEGY |
integrate.strategy |
GX_INTEGRATE_STRATEGY=rebase gx pull |
Contributing
To set up a development environment and send a change, read CONTRIBUTING.md.
License
gx is released under the MIT License.
Metadata
Release files for git-gx 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| git_gx-0.13.0.tar.gz | 85.6 kB | Without provenance | Details for git_gx-0.13.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| git_gx-0.13.0-py3-none-any.whl | Python 3 | none | any | Details for git_gx-0.13.0-py3-none-any.whl |
Total release size: 181.0 kB
Release files / git_gx-0.13.0.tar.gz
| Download URL | git_gx-0.13.0.tar.gz |
|---|---|
| Size | 85.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
372aea05b4cd152d05f869eeb6719a8599f5302c4cbb18965e91d9aa15cf1b4d
|
|
BLAKE2b-256 checksum How to use checksums |
c9ccc73d0a1f424b8677f2983d607b561104f5f8e795a85cae99ab33f1d2be60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.11 {"installer":{"name":"uv","version":"0.13.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / git_gx-0.13.0-py3-none-any.whl
| Download URL | git_gx-0.13.0-py3-none-any.whl |
|---|---|
| Size | 95.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
56622ebfdcfcc11979b31f9f68ec06ace1877fa39edee56c277240026a3774ce
|
|
BLAKE2b-256 checksum How to use checksums |
d0c4a6416aa28b651821663ff34437f833487e0ae782a64f571daaa0d3aca217
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.11 {"installer":{"name":"uv","version":"0.13.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for git-gx 0.13.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.