{"id":13527723,"url":"https://github.com/arialdomartini/oh-my-git","last_synced_at":"2025-05-15T00:09:54.882Z","repository":{"id":10163011,"uuid":"12244286","full_name":"arialdomartini/oh-my-git","owner":"arialdomartini","description":"An opinionated git prompt for bash and zsh","archived":false,"fork":false,"pushed_at":"2022-06-30T09:34:39.000Z","size":144,"stargazers_count":3678,"open_issues_count":56,"forks_count":286,"subscribers_count":73,"default_branch":"master","last_synced_at":"2025-05-13T02:12:51.304Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arialdomartini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-20T13:52:00.000Z","updated_at":"2025-05-09T21:19:08.000Z","dependencies_parsed_at":"2022-07-21T04:49:31.650Z","dependency_job_id":null,"html_url":"https://github.com/arialdomartini/oh-my-git","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arialdomartini%2Foh-my-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arialdomartini%2Foh-my-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arialdomartini%2Foh-my-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arialdomartini%2Foh-my-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arialdomartini","download_url":"https://codeload.github.com/arialdomartini/oh-my-git/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249206,"owners_count":22039029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:58.714Z","updated_at":"2025-05-15T00:09:49.827Z","avatar_url":"https://github.com/arialdomartini.png","language":"Shell","funding_links":[],"categories":["Customization","Themes","Shell","others","Shells","Prompts and Color Themes"],"sub_categories":["ZSH on Windows","Zinit (née zplugin)","Git","Reusable Things","Directory Navigation"],"readme":"\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/01-ordinary-prompt.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/02-bang.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/03-useful-information.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/04-untracked-files.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/06-rm-commit.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/06-tris-colors.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/07-tracking-branches.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/08-push-rebase-and-remote-branch-names.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/09-you-can-push.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/10-you-are-behind-fast-forward.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/11-diverged.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/12-detached.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/13-stash-and-tag.jpg)\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/14-action-in-progress.jpg)\n\n\n![alt tag](https://raw.github.com/arialdomartini/oh-my-git-gh-pages/gh-pages/images/shut-up.gif)\n\n\n# Installation\n## \u003ca name=\"install-the-font\"\u003e\u003c/a\u003eThe Font\n\noh-my-git is shipped with 3 themes. The one showed above is called [oppa-lana-style](https://github.com/arialdomartini/oh-my-git-themes/blob/oppa-lana-style/oppa-lana-style.zsh-theme). It's based on the [Awesome-Terminal-Fonts](https://github.com/gabrielelana/awesome-terminal-fonts) by [@gabrielelana](https://github.com/gabrielelana). The screenshots above use the font [Source Code Pro](https://github.com/adobe/Source-Code-Pro) by Adobe patched to include additional glyphs from [Powerline](https://github.com/powerline/powerline) and from Awesome-Terminal-Fonts, but you can choose any other of the Awesome-Terminal-Fonts.\n\nYou can freely [download](https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched) the fonts from the original repo.\n\nTo install one of the fonts, on macOS just double click on the corresponding ```ttf``` file and click on ```Install font```. So far, I didn't find a way to make the fallback strategy work on macOS.\n\nOn Linux you can either [install the patched font](#install-the-patched-font) or you can apply the Awesome-Terminal-Fonts [fallback strategy](https://github.com/gabrielelana/awesome-terminal-fonts/blob/master/README.md#patching-vs-fallback).\n    \nThen, configure your terminal with the desired font, and restart it.\n\n## Bash\n\nOne liner for macOS:\n\n    git clone https://github.com/arialdomartini/oh-my-git.git ~/.oh-my-git \u0026\u0026 echo source ~/.oh-my-git/prompt.sh \u003e\u003e ~/.profile\n\nOne liner for Ubuntu:\n\n    git clone https://github.com/arialdomartini/oh-my-git.git ~/.oh-my-git \u0026\u0026 echo source ~/.oh-my-git/prompt.sh \u003e\u003e ~/.bashrc\n\nThen restart your Terminal.\n\n\n## Manual installation\n\nFork the repo and git clone it in your home directory.\n\nThen add\n\n    source $HOME/oh-my-git/prompt.sh\n\nto the bash startup file (`~/.profile` on Mac, `~/.bashrc` on Linux)\n\nIf you prefer to keep oh-my-git repository in a different directory, just modify the startup file accordingly to the chosen position\n\n    source /wherever-you-want/oh-my-git/prompt.sh\n\n## zsh\n\nWith antigen installed, just add\n\n    antigen use oh-my-zsh\n    antigen bundle arialdomartini/oh-my-git\n    antigen theme arialdomartini/oh-my-git-themes oppa-lana-style\n\nto your `.zshrc` file.\n\n[`oh-my-git-themes`](https://github.com/arialdomartini/oh-my-git-themes) still includes the old 2 themes [arialdo-granzestyle](https://github.com/arialdomartini/oh-my-git-themes/blob/master/arialdo-granzestyle.zsh-theme)  (which is inspired to the great [Granze theme](https://github.com/Granze/G-zsh-theme-2)) by [@granze](https://github.com/granze), and [arialdo-pathinline](https://github.com/arialdomartini/oh-my-git-themes/blob/master/arialdo-pathinline.zsh-theme). If you want to use them, edit accordingly your ```.zshrc``` file.\n\n## Fig\n\n[Fig](https://fig.io) adds apps, shortcuts, and autocomplete to your existing terminal.\n\nInstall `oh-my-git` in just one click.\n\n\u003ca href=\"https://fig.io/plugins/other/oh-my-git\" target=\"_blank\"\u003e\u003cimg src=\"https://fig.io/badges/install-with-fig.svg\" /\u003e\u003c/a\u003e\n\n## How to install antigen\n\n[antigen](https://github.com/zsh-users/antigen) is a plugin manager for `zsh`.\nInstalling antigen is straightforward:\n\n    cd ~ \u0026\u0026 git clone https://github.com/zsh-users/antigen.git .antigen \n\nThen, edit your `.zshrc` file including\n\n    source \"$HOME/.antigen/antigen.zsh\"\n\n    antigen use oh-my-zsh\n    antigen bundle arialdomartini/oh-my-git\n    antigen theme arialdomartini/oh-my-git-themes oppa-lana-style\n\n    antigen apply\n\nWhen you restart zsh, antigen will download and install all that's needed.\n\n# Customizing symbols\n\nYou can easily change any symbols used by the prompt. Take a look to the file [prompt.sh](https://github.com/arialdomartini/oh-my-git/blob/master/prompt.sh) (or to [oppa-lana-style.zsh-theme](https://github.com/arialdomartini/oh-my-git-themes/blob/master/oppa-lana-style.zsh-theme) if you use zsh). You will find a bunch of variables, each of them with its default value. The variables names should be auto-explanatory. Something like\n\n```\n: ${omg_is_a_git_repo_symbol:='❤'}\n: ${omg_has_untracked_files_symbol:='∿'}\n: ${omg_has_adds_symbol:='+'}\n: ${omg_has_deletions_symbol:='-'}\n: ${omg_has_cached_deletions_symbol:='✖'}\n: ${omg_has_modifications_symbol:='✎'}\n: ${omg_has_cached_modifications_symbol:='☲'}\n: ${omg_ready_to_commit_symbol:='→'}\n: ${omg_is_on_a_tag_symbol:='⌫'}\n```\n\nYou can override any of those variables in your shell startup file.\n\nFor example, just add a\n\n```\nomg_is_on_a_tag_symbol='#'\n```\n\nto your `.bashrc` file, and oh-my-git will use `#` when you are on a tag.\n\n\n# Disabling oh-my-git\noh-my-git can be disabled on a per-repository basis. Just add a\n\n    [oh-my-git]\n    enabled = false\n\nin the `.git/config` file of a repo to revert to the original prompt for that particular repo. This could be handy when working with very huge repository, when the git commands invoked by oh-my-git can slow down the prompt.\n\n# Uninstall\n\n## Bash\n* Remove the line `source ~/.oh-my-git/prompt.sh` from the terminal boot script (`.profile` or `.bash_rc`)\n* Delete the oh-my-git repo with a `rm -fr ~/.oh-my-git`\n\n## zsh\nRemove the lines\n\n```\nantigen use oh-my-zsh\nantigen bundle arialdomartini/oh-my-git\nantigen theme arialdomartini/oh-my-git-themes oppa-lana-style\n```\n\nfrom your `.zshrc` file\n\n# Troubleshooting\n\n#### Help, I installed oh-my-git but this is what I see:\n\n\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/bad-font.png)\n\n**A**: It's likely that you forgot to [install the font](#install-the-font).\n\n---\n\n#### I don't want to install a new font!\n\n**A**: \"No prob. You may select [another theme](https://github.com/arialdomartini/oh-my-git-themes), or you can customize symbols. Take a look to the [prompt.sh](https://github.com/arialdomartini/oh-my-git/blob/master/prompt.sh) file. It contains a list of pre-defined symbols, similar to:\n\n    # Symbols\n    : ${omg_is_a_git_repo_symbol:='❤'}\n    : ${omg_has_untracked_files_symbol:='∿'}\n    : ${omg_has_adds_symbol:='+'}\n    : ${omg_has_deletions_symbol:='-'}\n    : ${omg_has_modifications_symbol:='✎'}\n\nThose are just default values. If you wish to use another glyph for untracked file, just define a\n\n    omg_has_untracked_files_symbol=\"whatever\"\n\nin your shell startup file.\n\n---\n#### With Bash the last symbol looks very bad, like this\n\n![oh-my-git](https://cloud.githubusercontent.com/assets/6009528/6031476/0b9bfe2c-ac00-11e4-898a-324a71be6cb5.png)\n\n**A**: Unfortunately, I haven't find a way to tell bash \"*print the next symbol using the background color currently used by the terminal*\" and as far as I know [there's no way to achieve this result](http://unix.stackexchange.com/questions/1755/change-the-ps1-color-based-on-the-background-color#tab-top). Zsh is not affected by this issue, but bash is.\n\nAs a consequence, when printing the last symbol, oh-my-git has no choice but setting explicitly the foreground and background colors. Currently, the standard background color is black. This is unfortunate, because if the terminal uses a different background color than black, the result is bad, as showed in the above screenshot.\n\nA smart solution is the one proposed by [@Sgiath](https://github.com/Sgiath): in the color palette set the first color (the one in the top-left corner) same as background color, like this\n\n![oh-my-git](https://cloud.githubusercontent.com/assets/6009528/6039646/454c965e-ac69-11e4-8f80-37425181d04b.png)\n\nThis in fact sets the \"black\" color to the same color used as the terminal background.\n\n\nIf for any reasons you cannot change the palette, you can override the colors used to render the last symbol with the variable `omg_last_symbol_color`.\n\nFor example, if the terminal is using a gray background, you can add a\n\n```\nbackground=240\nred='\\e[0;31m'\nomg_last_symbol_color=\"${red}\\[\\033[48;5;${background}m\\]\"\n```\n\nto your `.bashrc` and fix the issue by choosing the right value for `background`.\n\nYou can use\n\n```\nforeground=160\nbackground=240\nomg_last_symbol_color=\"\\[\\033[38;5;${foreground}m\\]\\[\\033[48;5;${background}m\\]\"\n```\n\nif you want a more detailed control on the colors.\n\nFinding the right value is not trivial. Please, refer to [this page](http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux) for a the 256 colors code table.\n\n---\n\n#### On OS X, I configured iTerm2 with the patched font, but the prompt is still broken.\n\n**A**: iTerm2 preferences have 2 sections for setting the font: one for `Regular Font` and one for `Non-ASCII Font`.\nThe font should be set on both the sections, like showed in the following screenshot:\n\n![iTerm2 Preferences Page](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/iterm2.png)\n\n---\n\n#### \u003ca name=\"install-the-patched-font\"\u003e\u003c/a\u003eHelp! On Linux I can't install the font!\n\n**A**: You should refer to the documentation of [Awesome-Terminal-Fonts](https://github.com/gabrielelana/awesome-terminal-fonts). Anyway, this is how I personally setup the prompt on Ubuntu\n\n    # Copy the awesome fonts to ~/.fonts\n    cd /tmp\n    git clone http://github.com/gabrielelana/awesome-terminal-fonts\n    cd awesome-terminal-fonts\n    git checkout patching-strategy\n    mkdir -p ~/.fonts\n    cp patched/*.ttf ~/.fonts\n\n    # update the font-info cache\n    sudo fc-cache -fv ~/.fonts\n\nThen, run ```gnome-terminal``` (or whatever terminal you like) and select one of the awesome-fonts\n\n![alt tag](https://raw.githubusercontent.com/arialdomartini/oh-my-git-gh-pages/master/images/samples/gnome-terminal.png)\n\nFinally, install oh-my-zsh with the one-liner (if you use Bash) or with Antigen if you love zsh, and restart the Terminal.\n\n---\n\n#### When I'm not in a git repo, I want to use my old, beloved prompt...\n\n**A**: Sure! Use the variable `omg_ungit_prompt`. Store there your old prompt: it will be used when you are not in a git repo.\n\n---\n\n#### Help! I used the one-liner for OS X, but the prompt doesn't start!\n\n**A**: The one-liner for OS X adds the startup command in ```~/.profile```, which is the startup file for generic login shells. If a ```~/.bash_profile``` is present, this is used in place of ```.profile```, and ```.profile``` itself is ignored. To solve your issue, use this alternative one-liner\n\n    cd ~ \u0026\u0026 git clone https://github.com/arialdomartini/oh-my-git.git \u0026\u0026 echo source $HOME/.oh-my-git/prompt.sh \u003e\u003e .bash_profile\n\nor just move the startup command\n\n    echo source $HOME/oh-my-git/prompt.sh\n\nfrom ```.profile``` to ```.bash_profile```\n\n---\n\n#### Hey, where's my current virtualenv name? It disappeared from the prompt! Or it appears like this\n\n![virtualenv badly rendered](https://cloud.githubusercontent.com/assets/150719/5852434/06933e88-a217-11e4-81a0-153c5a300b0a.png)\n\n**A**: Yes, actually the virtualenv's approach with prompts is pretty disappointing (see [Virtualenv's bin/activate is Doing It Wrong](https://gist.github.com/datagrok/2199506)): in fact, the script ```activate``` performs a\n\n```\nPS1=\"(`basename \\\"$VIRTUAL_ENV\\\"`)$PS1\"\n```\n\nthat arrogantly prepends the virtualenv name to the current ```PS1```, leaving you no opportunity to customise the output.\n\nYou can solve this problem disabling the standard virtualenv prompt injection and using the callback function `omg_prompt_callback`.\n\nAdd\n\n```\nVIRTUAL_ENV_DISABLE_PROMPT=true\nfunction omg_prompt_callback() {\n    if [ -n \"${VIRTUAL_ENV}\" ]; then\n        echo \"\\e[0;31m(`basename ${VIRTUAL_ENV}`)\\e[0m \"\n    fi\n}\n```\n\nto your shell startup script. It should render the prompt inside an active virtualenv like this\n\n![a proper virtualenv rendering](https://cloud.githubusercontent.com/assets/150719/5852429/e50d18a6-a216-11e4-9b0e-c902f47a1ca4.png)]\n\nYou can use the call back function to inject whatever you want at the beginning of the second line.\n\n# Known bugs and limitations\n\n* git v1.8.4 or newer is required\n* It works weird on brand new repositories, before the first commit\n* It has been tested on Mac and Ubuntu only. I never managed to make it work on Cygwin\n* Depending on the theme selected, you need an unicode font (like Sauce Code Pro, Menlo or Monaco on Mac OS X, or Monospace on Ubuntu; on Windows, with Cygwin, a good choice is [Meslo](https://github.com/andreberg/Meslo-Font) by [André Berg](https://github.com/andreberg), but I didn't tested the ooppa-lana-style theme)\n* If the Terminal uses a clear background color, in Bash you need to change the colors defined in [prompt.sh](https://github.com/arialdomartini/oh-my-git/blob/oppa-lana-style/prompt.sh). The zsh version is not affected by this problem.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farialdomartini%2Foh-my-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farialdomartini%2Foh-my-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farialdomartini%2Foh-my-git/lists"}