{"id":13567548,"url":"https://github.com/jimeh/git-aware-prompt","last_synced_at":"2025-05-15T09:07:57.548Z","repository":{"id":724351,"uuid":"372154","full_name":"jimeh/git-aware-prompt","owner":"jimeh","description":"Display current Git branch name in your terminal prompt when in a Git working directory.","archived":false,"fork":false,"pushed_at":"2023-09-13T01:21:48.000Z","size":42,"stargazers_count":2161,"open_issues_count":37,"forks_count":340,"subscribers_count":64,"default_branch":"master","last_synced_at":"2025-05-13T13:19:36.961Z","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":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jimeh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2009-11-13T21:43:12.000Z","updated_at":"2025-03-22T08:45:42.000Z","dependencies_parsed_at":"2023-01-11T15:47:42.300Z","dependency_job_id":"e34bc700-ede5-4cca-b368-e3a7037ed34c","html_url":"https://github.com/jimeh/git-aware-prompt","commit_stats":{"total_commits":51,"total_committers":12,"mean_commits":4.25,"dds":"0.33333333333333337","last_synced_commit":"df8f218d4af51b1fac03f58bf0ddc776466312de"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Fgit-aware-prompt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Fgit-aware-prompt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Fgit-aware-prompt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimeh%2Fgit-aware-prompt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimeh","download_url":"https://codeload.github.com/jimeh/git-aware-prompt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310520,"owners_count":22049470,"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-01T13:02:34.340Z","updated_at":"2025-05-15T09:07:52.539Z","avatar_url":"https://github.com/jimeh.png","language":"Shell","readme":"# Git Aware Prompt\n\nWorking with Git and its great branching/merging features is\namazing. Constantly switching branches can be confusing though as you have to\nrun `git status` to see which branch you're currently on.\n\nThe solution to this is to have your terminal prompt display the current\nbranch. There's a [number][1] [of][2] [articles][3] [available][4] online\nabout how to achieve this. This project is an attempt to make an easy to\ninstall/configure solution.\n\n[1]: http://aaroncrane.co.uk/2009/03/git_branch_prompt/\n[2]: http://railstips.org/2009/2/2/bedazzle-your-bash-prompt-with-git-info\n[3]: http://techblog.floorplanner.com/2008/12/14/working-with-git-branches/\n[4]: http://www.intridea.com/2009/2/2/git-status-in-your-prompt\n\n\n## Overview\n\nIf you `cd` to a Git working directory, you will see the current Git branch\nname displayed in your terminal prompt. When you're not in a Git working\ndirectory, your prompt works like normal.\n\n![Git Branch in Prompt](https://raw.github.com/jimeh/git-aware-prompt/master/preview.png)\n\n\n## Installation\n\nClone the project to a `.bash` folder in your home directory:\n\n```bash\nmkdir ~/.bash\ncd ~/.bash\ngit clone https://github.com/jimeh/git-aware-prompt.git\n```\n\nEdit your `~/.bash_profile` or `~/.profile` or `~/.bashrc` (for Ubuntu) and add the following to the top:\n\n```bash\nexport GITAWAREPROMPT=~/.bash/git-aware-prompt\nsource \"${GITAWAREPROMPT}/main.sh\"\n```\n\n\n## Configuring\n\nOnce installed, there will be new `$git_branch` and `$git_dirty` variables\navailable to use in the `PS1` environment variable, along with a number of\ncolor helper variables which you can see a list of in [colors.sh][].\n\n[colors.sh]: https://github.com/jimeh/git-aware-prompt/blob/master/colors.sh\n\nIf you want to know more about how to customize your prompt, I recommend\nthis article: [How to: Change / Setup bash custom prompt (PS1)][how-to]\n\n[how-to]: http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html\n\n\n### Suggested Prompts\n\nBelow are a few suggested prompt configurations. Simply paste the code at the\nend of the same file you pasted the installation code into earlier.\n\n\n#### Mac OS X\n\n```bash\nexport PS1=\"\\u@\\h \\W \\[\\$txtcyn\\]\\$git_branch\\[\\$txtred\\]\\$git_dirty\\[\\$txtrst\\]\\$ \"\n```\n\nOptionally, if you want a nice pretty prompt when using `sudo -s`, also add\nthis line:\n\n```bash\nexport SUDO_PS1=\"\\[$bakred\\]\\u@\\h\\[$txtrst\\] \\w\\$ \"\n```\n\n\n#### Ubuntu\n\nStandard:\n\n```bash\nexport PS1=\"\\${debian_chroot:+(\\$debian_chroot)}\\u@\\h:\\w \\[$txtcyn\\]\\$git_branch\\[$txtred\\]\\$git_dirty\\[$txtrst\\]\\$ \"\n```\n\nColorized:\n\n```bash\nexport PS1=\"\\${debian_chroot:+(\\$debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\] \\[$txtcyn\\]\\$git_branch\\[$txtred\\]\\$git_dirty\\[$txtrst\\]\\$ \"\n```\n\n#### Windows\n\n```bash\nexport PS1=\"\\[\\033]0;$MSYSTEM:\\w\\007\\033[32m\\]\\u@\\h:\\[\\033[33m\\w \\[$txtcyn\\]\\$git_branch\\[$txtred\\]\\$git_dirty\\[$txtrst\\]\\033[0m\\]\\$ \"\n```\n\n## Updating\n\nAssuming you followed the default installation instructions and cloned this\nrepo to `~/.bash/git-aware-prompt`:\n\n```bash\ncd ~/.bash/git-aware-prompt\ngit pull\n```\n\n\n## Usage Tips\n\nTo view other user's tips, please check the\n[Usage Tips](https://github.com/jimeh/git-aware-prompt/wiki/Usage-Tips) wiki\npage. Or if you have tips of your own, feel free to add them :)\n\n\n## License\n\n[CC0 1.0 Universal](http://creativecommons.org/publicdomain/zero/1.0/)\n","funding_links":[],"categories":["Shell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimeh%2Fgit-aware-prompt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimeh%2Fgit-aware-prompt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimeh%2Fgit-aware-prompt/lists"}