{"id":19541620,"url":"https://github.com/bluz71/git-status-fly","last_synced_at":"2025-08-11T17:39:58.369Z","repository":{"id":159696150,"uuid":"634792653","full_name":"bluz71/git-status-fly","owner":"bluz71","description":"A fast git status utility for custom prompts","archived":false,"fork":false,"pushed_at":"2025-04-01T06:31:53.000Z","size":28,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T07:34:15.323Z","etag":null,"topics":["bash","fish","git","prompt","rust","shell-prompt","zsh"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/bluz71.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":"2023-05-01T07:49:55.000Z","updated_at":"2025-04-01T06:31:57.000Z","dependencies_parsed_at":"2024-11-11T03:11:30.087Z","dependency_job_id":"21d41482-4095-43dc-ab41-018e3a5a59c4","html_url":"https://github.com/bluz71/git-status-fly","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"407d9cd3de7c5670402c1620d96f563db8fb8718"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fgit-status-fly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fgit-status-fly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fgit-status-fly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fgit-status-fly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluz71","download_url":"https://codeload.github.com/bluz71/git-status-fly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251025618,"owners_count":21524832,"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":["bash","fish","git","prompt","rust","shell-prompt","zsh"],"created_at":"2024-11-11T03:11:18.256Z","updated_at":"2025-04-26T17:30:54.714Z","avatar_url":"https://github.com/bluz71.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"git-status-fly\n==============\n\n_git-status-fly_ is a utility implemented in [Rust](https://www.rust-lang.org)\nthat runs and parses `git status` to constituent shell environment variables\nthat can be sourced by a Bash, Zsh or Fish script to render a fast Git-aware\nprompt.\n\nMany custom prompts directly run and parse `git status` using shell commands.\nHowever, parsing the output of `git status` using shell commands is **much**\nslower than doing the same using optimized Rust, often twice as slow depending\non the size of the repository.\n\nNote, this utility is used to accelerate the\n[bash-seafly-prompt](https://github.com/bluz71/bash-seafly-prompt).\n\nInstallation\n------------\n\nCopy, and untar, the appropriate _git-status-fly_ binary, from **Releases**, to\nsomewhere in the current `$PATH`.\n\nAlternatively, if the Rust build chain is available, clone this repository and\nbuild a release via `cargo build --release` and copy the `git-status-fly`\nbinary from `target/release` to somewhere in the current `$PATH`.\n\nRequirements\n------------\n\nGit version `2.11`, released in November 2016, or later is required.\n\nUsage\n-----\n\nIn your prompt script source the output of _git_status_fly_ to evaluate the\ncurrent Git state.\n\nIn Bash or Zsh that would look as follows:\n\n```bash\n. \u003c(git-status-fly)\n```\n\nAnd in Fish:\n\n```fish\ngit-status-fly | source\n```\n\nNote, if using Fish just as an interactive shell, as opposed to a login shell,\nplease make sure that the `SHELL` environment variable is set to your running\nversion of the fish executable (for example `/bin/fish`).\n\nHere is an example usage of _git-status-fly_ in a very simple Bash prompt\nscript:\n\n```bash\n_my_prompt() {\n    . \u003c(git-status-fly)\n\n    if [[ -n $GSF_REPOSITORY ]]; then\n        PS1=\"\\w $GSF_BRANCH\u003e \"\n    else\n        PS1=\"\\w\u003e \"\n    fi\n}\n\nPROMPT_COMMAND=_my_prompt\n```\n\nRefer to the _bash-seafly-prompt_ [command\nscript](https://github.com/bluz71/bash-seafly-prompt/blob/master/command_prompt.bash)\nfor a real-world usage of _git-status-fly_.\n\nImplementation\n--------------\n\n_git-status-fly_ will run the following `git status` command in the current\nworking directory:\n\n```sh\ngit --no-optional-locks status --porcelain=v2 --branch --show-stash --ignore-submodules -uno\n```\n\nThe result from that `git status` command will internally be parsed and\ntransformed to a series of shell environment variable statements, ready for\nsourcing from a custom prompt script.\n\nThe relevant environment variables, using the `GSF` prefix (short for Git Status\nFlag), will be:\n\n| Environment Variable | Description                                       | Value       |\n|----------------------|---------------------------------------------------|-------------|\n| **`GSF_REPOSITORY`** | The current working directory is a Git repository | `1`         |\n| **`GSF_BRANCH`**     | The name of the current branch                    | String      |\n| **`GSF_DIRTY`**      | The index has unstaged changes                    | `1`         |\n| **`GSF_STAGED`**     | The index has staged changes                      | `1`         |\n| **`GSF_UPSTREAM`**   | Remote tracking differences exist                 | Refer below |\n| **`GSF_STASH`**      | At least one stash exists                         | `1`         |\n\n**`GSF_UPSTREAM`** values:\n\n- `0` Current and remote branches are equal\n\n- `1` Current branch is ahead of remote tracking branch\n\n- `-1` Current branch is behind remote tracking branch\n\n- `2` Current and remote branches have diverged\n\nNote, the absence of any environment variable indicates falsehood, for example\nif `GSF_REPOSITORY` is unset then that signals the current directory is not a\nGit repository.\n\nFor performance reasons, untracked files and change counts are ignored.\n\nRecommendations\n---------------\n\nVery large repositories, such as the [Linux\nkernel](https://github.com/torvalds/linux) and the [Chromium\nbrowser](https://github.com/chromium/chromium), will result in slow `git status`\nexecution.\n\nFor such repositories, it is strongly recommended to enable the following\nconfiguration options directly in those very large repositories:\n\n- `git config feature.manyFiles true` will adopt internal Git settings to improve\n  performance for large repositories as [documented\n  here](https://github.blog/2019-11-03-highlights-from-git-2-24/)\n\n- `git config core.fsmonitor true` will enable Git file system monitor as\n  [documented\n  here](https://github.blog/2022-06-29-improve-git-monorepo-performance-with-a-file-system-monitor)\n\nNote, as of May 2023 `fsmonitor` is only available for Windows and macOS.\n\nLicense\n-------\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluz71%2Fgit-status-fly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluz71%2Fgit-status-fly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluz71%2Fgit-status-fly/lists"}