{"id":25021689,"url":"https://github.com/bluz71/git-status-snap","last_synced_at":"2026-05-03T01:43:35.792Z","repository":{"id":273666516,"uuid":"920470936","full_name":"bluz71/git-status-snap","owner":"bluz71","description":"A fast git status utility for custom prompts","archived":false,"fork":false,"pushed_at":"2025-12-24T03:52:44.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-25T17:04:39.022Z","etag":null,"topics":["bash","crystal-lang","fish","git","prompt","shell-prompt","zsh"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-22T07:58:26.000Z","updated_at":"2025-12-24T03:52:47.000Z","dependencies_parsed_at":"2025-01-22T09:23:41.406Z","dependency_job_id":"7f960230-dad6-4e0a-8f39-3f76549be151","html_url":"https://github.com/bluz71/git-status-snap","commit_stats":null,"previous_names":["bluz71/git-status-snap"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bluz71/git-status-snap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fgit-status-snap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fgit-status-snap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fgit-status-snap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fgit-status-snap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluz71","download_url":"https://codeload.github.com/bluz71/git-status-snap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluz71%2Fgit-status-snap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32555839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T00:31:16.350Z","status":"ssl_error","status_checked_at":"2026-05-03T00:31:15.546Z","response_time":132,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","crystal-lang","fish","git","prompt","shell-prompt","zsh"],"created_at":"2025-02-05T13:23:26.045Z","updated_at":"2026-05-03T01:43:35.777Z","avatar_url":"https://github.com/bluz71.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"git-status-snap\n===============\n\n_git-status-snap_ is a utility implemented in\n[Crystal](https://crystal-lang.org/) that runs and parses `git status` to\nconstituent shell environment variables that can be sourced by a Bash, Zsh or\nFish script to render a fast Git-aware prompt.\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 Crystal, often twice as slow\ndepending on 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-snap_ binary, from **Releases**, to\nsomewhere in the current `$PATH`.\n\nAlternatively, if the Crystal build chain is available, clone this repository\nand build a release via `make` and copy the `git-status-snap` binary from\n`bin/git-status-snap` 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_snap_ to evaluate the\ncurrent Git state.\n\nIn Bash or Zsh that would look as follows:\n\n```bash\n. \u003c(git-status-snap)\n```\n\nAnd in Fish:\n\n```fish\ngit-status-snap | 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-snap_ in a very simple Bash prompt\nscript:\n\n```bash\n_my_prompt() {\n    . \u003c(git-status-snap)\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-snap_.\n\nImplementation\n--------------\n\n_git-status-snap_ 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-snap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluz71%2Fgit-status-snap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluz71%2Fgit-status-snap/lists"}