{"id":13665268,"url":"https://github.com/sbt/sbt-git","last_synced_at":"2025-05-15T17:04:22.681Z","repository":{"id":899969,"uuid":"2652954","full_name":"sbt/sbt-git","owner":"sbt","description":"A git plugin for sbt","archived":false,"fork":false,"pushed_at":"2025-05-09T13:24:55.000Z","size":368,"stargazers_count":356,"open_issues_count":35,"forks_count":103,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-05-09T14:39:13.715Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbt.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}},"created_at":"2011-10-26T18:18:57.000Z","updated_at":"2025-05-09T13:24:59.000Z","dependencies_parsed_at":"2024-11-09T18:11:53.655Z","dependency_job_id":"c2084a29-9058-4c5a-8331-29e93423bd7c","html_url":"https://github.com/sbt/sbt-git","commit_stats":{"total_commits":254,"total_committers":54,"mean_commits":4.703703703703703,"dds":0.6811023622047244,"last_synced_commit":"54d199b72ca2f1eb0c9eea7104ffbc3fc9c6ad41"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbt%2Fsbt-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbt%2Fsbt-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbt%2Fsbt-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbt%2Fsbt-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbt","download_url":"https://codeload.github.com/sbt/sbt-git/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384987,"owners_count":22062422,"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-02T06:00:31.345Z","updated_at":"2025-05-15T17:04:22.648Z","avatar_url":"https://github.com/sbt.png","language":"Scala","readme":"# sbt-git #\n\n[![Join the chat at https://gitter.im/sbt/sbt-git](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sbt/sbt-git?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nThe `sbt-git` plugin offers git command line features directly inside sbt as\nwell as allowing other plugins to make use of git.\n\n## Maintenance status\n\nThis plugin is community maintained. See https://github.com/sbt/sbt-git/issues/182 if you'd like to help.\n\n## Installation ##\nAs of `1.0.0` this plugin requires at least **Java 8**.\nThe latest version supporting Java 7 was `0.9.3`, while the latest version supporting Java 6 was `0.8.5`.\n\nLatest:\n\nAdd the following to your `project/plugins.sbt` or `~/.sbt/1.0/plugins/plugins.sbt` file:\n\n    addSbtPlugin(\"com.github.sbt\" % \"sbt-git\" % \"\u003cversion\u003e\")\n\nPrior to sbt 0.13.5:\n\nAdd the following to your `project/plugins.sbt` or `~/.sbt/0.13/plugins/plugins.sbt` file:\n\n    addSbtPlugin(\"com.typesafe.sbt\" % \"sbt-git\" % \"0.7.1\")\n\nadditionally, use one of the older README.md files: (https://github.com/sbt/sbt-git/blob/v0.7.1/README.md)\n\n### JGit ###\n\nJGit is a Java interface to git that allows some git operations to be\nperformed in the JVM without invoking an external git executable. By default,\nthis plugin uses JGit for read-only operations such as inspecting HEAD; for\nwrite operations, it assumes a git executable is present and on the PATH and\nit uses that.\n\nIn certain circumstances you may want to force the use of JGit or an\nexecutable for both read-only and read-write operations; for example, if no\ngit executable is present (e.g. you use windows and you haven't installed git\nor it's not on your PATH) you need to disable the console interface, or if\nyou rely on a git feature that JGit does not support (e.g. worktrees) you need\nto disable the JGit interface.\n\nThe following settings will force the use of only JGit or a git executable,\nrespectively:\n\n* `useJGit`\n* `useReadableConsoleGit`\n\nThese settings can be included in your project's `git.sbt` or in\n`~/.sbt/1.0/git.sbt` -- for example, if no git executable is installed,\neither file can have the following contents:\n\n    useJGit\n\nOr you can `set` the appropriate setting in the sbt prompt:\n\n    \u003e set useReadableConsoleGit\n    [info] Reapplying settings...\n    [info] Set current project to scala-arm (in build file:...)\n    \u003e session save\n    [info] Reapplying settings...\n    [info] Set current project to scala-arm (in build file:...)\n\n## Versioning with Git ##\n\nYou can begin to use git to control your project versions.\n\n    enablePlugins(GitVersioning)\n\nThe git plugin will now autogenerate your version using the following rules, in order:\n\n1. Looks at version-property setting (default to `project.version`), and checks the `sys.props` to see if this has a value.  If so, use it.\n2. Otherwise, looks at the project tags. The first to match the `gitTagToVersionNumber` setting is used to assign the version.  The default is to look for tags that begin with `v` and a number, and use the number as the version. If there are multiple version tags, it will pick the highest.\n3. If no tags are found either, look at the head commit. We attach this to the `git.baseVersion` setting: \"\u0026lt;base-version\u0026gt;.\u0026lt;git commit sha\u0026gt;\"\n4. If no head commit is present either (which means this is a brand-new repository with no commits yet), we append the current timestamp to the base version: \"\u0026lt;base-version\u0026gt;.\u0026lt;timestamp\u0026gt;\".\n\nThe `git.baseVersion` setting represents the in-development (upcoming) version you're working on.\n\nYou can alter the tag-detection algorithm using the `git.gitTagToVersionNumber` setting. For example, if we wanted to alter the default version tag detection so it does not require a \"v\" at the start of tags, we could add the following setting:\n\n    git.gitTagToVersionNumber := { tag: String =\u003e\n      if(tag matches \"[0-9]+\\\\..*\") Some(tag)\n      else None\n    }\n\nYou can turn on version detection using `git describe` command by adding:\n\n    git.useGitDescribe := true\n\nThis way the version is derived by passing the result of `git describe` to the `gitTagToVersionNumber` function. The `describe` version is built from the last tag + number of commits since tag + short hash.  We recommend adopting the git describe approach.\n\nYou can enhance the git describe approach with `glob` pattern matching, to match only relevant tags (as per `git describe --match` functionality).  This may be useful if, for example, your repository contains multiple types of tag.\n\n    git.gitDescribePatterns := Seq(\"module-name-*\")\n\nAdditionally, you can also customize the version number generated by overriding one of the following keys:\n\n* `git.formattedShaVersion` - Should look up `git.gitHeadCommit` key and generate a version based on it.\n* `git.formattedDateVersion` - The version we'll use if git is unavailable on this repository, for some reason.\n\nAs an example, you can alter the default sha-based versions using the following code\n\n    git.formattedShaVersion := git.gitHeadCommit.value map { sha =\u003e s\"v$sha\" }\n\n\n## Prompts ##\n\nYou can use the git plugin to add the project name + the current branch to your prompt. Simply add this setting to every project:\n\n    enablePlugins(GitBranchPrompt)\n\n## Usage ##\n\nIn an sbt prompt, simply enter any git command.  e.g.\n\n    \u003e git status\n    # On branch main\n    # Changes not staged for commit:\n    #   (use \"git add \u003cfile\u003e...\" to update what will be committed)\n    #   (use \"git checkout -- \u003cfile\u003e...\" to discard changes in working directory)\n    #\n    #\tmodified:   build.sbt\n    #\tmodified:   project/plugins/project/Build.scala\n    #\n    # Untracked files:\n    #   (use \"git add \u003cfile\u003e...\" to include in what will be committed)\n    #\n    #\tsrc/site/\n    no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n\n## Known issues\nWhen running sbt, you will see the following warnings in console:\n```\nSLF4J: Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".\nSLF4J: Defaulting to no-operation (NOP) logger implementation\nSLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.\n```\n\nTo get rid of them, you can force the SLF4J no-op binder by adding `libraryDependencies += \"org.slf4j\" % \"slf4j-nop\" % \"1.7.21\"` to `~/.sbt/0.13/plugins/plugins.sbt`\n\n## Running the tests\n\nTests for this plugin are written using `sbt-scripted`. Test can be executed with \n\n```\nsbt scripted\n```\n\n## Licensing ##\n\nThis software is licensed under the BSD license.\n","funding_links":[],"categories":["Table of Contents","BUILD \u0026 RELEASE"],"sub_categories":["Sbt plugins"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbt%2Fsbt-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbt%2Fsbt-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbt%2Fsbt-git/lists"}