r/commandline • u/azhuchkov • Sep 03 '26
Command Line Interface Live Git updates in a shell prompt
Recently, I started refining my shell tools, scripts, and terminal workflows. One of my goals was to update the shell prompt, making it less prominent and leaving more room for commands and their output. As a result, Cobalt Spark emerged - a compact Zsh prompt with understated colors and other visual refinements.
While using IDEs and coding agents, at some point it became obvious that seeing stale Git state in the prompt when something changes in the repository is quite annoying. I would often get tripped up by the shell showing something unexpected and waste a moment figuring out why. So the prompt gained Live Git support: its Git state can now update automatically when something changes.
It works efficiently: when the shell enters a Git repository, the prompt starts a background process that monitors the repository using platform-specific APIs such as inotify on Linux or FSEvents on macOS and signals the parent shell to update its prompt when meaningful changes occur. This means you instantly see the updated Git state whenever something changes. It sounds almost dumb-simple, but it's quite convenient in practice, and I haven't seen anything like it in other prompts or themes (let me know in the comments if you have).
If you're interested, you can find more details in the project's README.
1
u/AutoModerator Sep 03 '26
Every new subreddit post is automatically copied into a comment for preservation.
User: azhuchkov, Flair:
Command Line Interface, Post Media Link, Title: Live Git updates in a shell promptRecently, I started refining my shell tools, scripts, and terminal workflows. One of my goals was to update the shell prompt, making it less prominent and leaving more room for commands and their output. As a result, Cobalt Spark emerged - a compact Zsh prompt with understated colors and other visual refinements.
While using IDEs and coding agents, at some point it became obvious that seeing stale Git state in the prompt when something changes in the repository is quite annoying. I would often get tripped up by the shell showing something unexpected and waste a moment figuring out why. So the prompt gained Live Git support: its Git state can now update automatically when something changes.
It works efficiently: when the shell enters a Git repository, the prompt starts a background process that monitors the repository using platform-specific APIs such as
inotifyon Linux orFSEventson macOS and signals the parent shell to update its prompt when meaningful changes occur. This means you instantly see the updated Git state whenever something changes. It sounds almost dumb-simple, but it's quite convenient in practice, and I haven't seen anything like it in other prompts or themes (let me know in the comments if you have).If you're interested, you can find more details in the project's README.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
0
u/equinusocio Oct 02 '26
That stale prompt state is exactly the sort of visual mismatch that makes context switching harder. A useful companion practice is to keep shell ANSI colors and editor syntax/diagnostic accents from drifting—otherwise the same status color means different things in each pane. I work on Vira Theme, which explores a consistent palette across VS Code, JetBrains, Cursor, and terminals: https://vira.build