gitmyhub

oh-my-git

Shell ★ 3.7k updated 4y ago

An opinionated git prompt for bash and zsh

oh-my-git is a shell prompt add-on for bash and zsh that shows the current state of a Git repository directly in the terminal prompt line. Git is a version control system developers use to track changes in code. When you are inside a folder that contains a Git repository, oh-my-git changes the prompt to display a row of symbols indicating what is happening: whether you have unsaved changes, new files that are not yet tracked, files staged for the next commit, whether your branch is ahead of or behind the remote copy, whether a merge or rebase operation is in progress, and more.

Each piece of information is represented by a small icon or symbol so you can read the repo state at a glance without typing any commands. The symbols are configurable. The defaults include things like a heart icon for being inside a Git repo, a pencil for modified files, a plus for added files, and an arrow when you are ready to commit. You can override any symbol by setting the corresponding variable in your shell startup file.

The project ships with three visual themes. The featured one uses special glyphs from a patched font called Awesome-Terminal-Fonts, which needs to be installed separately and set as your terminal font. If you prefer not to install a custom font, you can choose one of the other themes that use standard characters.

Installation for bash is a single command that clones the repository and adds a source line to your profile. For zsh, it works through the antigen plugin manager by adding a few lines to your .zshrc file. You can disable oh-my-git for a specific repository by adding a setting to that repository's local git config, which is useful for very large repos where the extra git queries might slow the prompt down.