Skip to content
Lesson 8 of 1267% of the course

Add git, your machine and your commands to the status line

Show the git branch, changes, pull request and worktree, your Python venv, Kubernetes context or AWS profile, and the output of any shell command or environment variable in your Claude Code status line.

Video coming soonAdd git, your machine and your commands to the status lineUntil then, the lesson below walks through every step.

Claude Code sends the status line script a lot of information about the session. Git and your machine are not part of it: for those, the script runs a command or reads an environment variable itself. This lesson covers those segments, and how to add anything else with a command of your own.

Show the state of your repository

The Directory & Git group has more than the branch:

SegmentWhat it shows
Git branchThe branch you are on
Git dirty / cleanThe number of changed files, a dot or tick, or a * when dirty (pick in Style)
Git ahead / behindCommits not yet pushed, and commits not yet pulled
Last commit age, hash and messageThe most recent commit
Stash count and untracked filesWhat is lying around
Nearest tagThe closest tag, like v1.4.0
Git worktreeThe git worktree you are in
Repository owner/name and hostWhere the repository lives, like anthropics/claude-code on github.com
Pull requestThe pull request number, optionally with its review state
Claude worktreeThe worktree Claude Code created for this session: its name, its branch, both, its path, or the branch you were on before you entered it (pick in Show)
The Pull Request template.

The git segments run git in your working folder. They hide themselves when the folder is not a repository, so your line stays clean elsewhere. Turn off In a git repo in Preview data to see that.

The Pull Request template shows a good combination for review work: branch, pull request, sync state and the size of the diff.

Show where you are

  • Current directory is the folder Claude Code works in; pick the folder name only, parent/folder, ~/path or the full path
  • Project directory is the folder you started Claude Code in, which can differ once it moves around
  • Added dirs count shows how many extra folders you gave Claude Code access to

Show your environment

The Machine group reads your system:

  • Python venv / conda reads VIRTUAL_ENV, and falls back to CONDA_DEFAULT_ENV
  • Kubernetes context runs kubectl config current-context
  • AWS profile reads AWS_PROFILE
  • Battery %, Load average, Uptime and Disk free show your machine's state
The editor names the command a segment runs.

Showing the Kubernetes context and AWS profile in the line under your prompt is a cheap safety net: you see prod before you ask Claude to run something. The Ops template combines them.

Read any environment variable

Any environment variable shows the value of a variable you name. Set Variable name (for example NODE_ENV) and a Preview value so the preview has something to draw. Use it for your own conventions, like a STAGE or TENANT variable.

Run your own command

Custom shell command runs a command in your working folder and shows the first line of its output. Set Command and a Preview value.

A few ideas:

git log -1 --format=%h          # the short hash of the last commit
node --version                  # the Node.js version in this folder
cat .nvmrc 2>/dev/null          # the Node version this project asks for
docker context show             # the active Docker context

Add fixed text

Custom text / emoji shows any text you type, like a label for the machine (🏠 home) or a reminder. It does not change, so it is best used sparingly, as a marker.

The next lesson opens the generated script: what Claude Code sends it, and how Bash, Python and Node.js differ.

Your progress stays in this browser only.
Contact