{"id":13462146,"url":"https://github.com/src-d/go-git","last_synced_at":"2025-10-05T17:31:36.736Z","repository":{"id":44902542,"uuid":"44739044","full_name":"src-d/go-git","owner":"src-d","description":"Project has been moved to: https://github.com/go-git/go-git","archived":true,"fork":false,"pushed_at":"2022-04-10T11:14:17.000Z","size":3319,"stargazers_count":4904,"open_issues_count":227,"forks_count":541,"subscribers_count":95,"default_branch":"master","last_synced_at":"2024-10-15T08:38:10.529Z","etag":null,"topics":["git","git-client","git-server","go-git","golang"],"latest_commit_sha":null,"homepage":"https://github.com/go-git/go-git","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/src-d.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-22T10:43:33.000Z","updated_at":"2024-10-15T08:17:19.000Z","dependencies_parsed_at":"2022-09-13T03:11:12.111Z","dependency_job_id":null,"html_url":"https://github.com/src-d/go-git","commit_stats":null,"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/src-d","download_url":"https://codeload.github.com/src-d/go-git/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235059580,"owners_count":18929290,"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":["git","git-client","git-server","go-git","golang"],"created_at":"2024-07-31T12:00:40.102Z","updated_at":"2025-10-05T17:31:31.284Z","avatar_url":"https://github.com/src-d.png","language":"Go","readme":"## WE CONTINUE THE DEVELOPMENT AT [go-git/go-git](https://github.com/go-git/go-git). This repository is abandoned, and no further updates will be done on the code base, nor issue/prs will be answered or attended.\n\n![go-git logo](https://cdn.rawgit.com/src-d/artwork/02036484/go-git/files/go-git-github-readme-header.png)\n[![GoDoc](https://godoc.org/gopkg.in/src-d/go-git.v4?status.svg)](https://godoc.org/github.com/src-d/go-git) [![Build Status](https://travis-ci.org/src-d/go-git.svg)](https://travis-ci.org/src-d/go-git) [![Build status](https://ci.appveyor.com/api/projects/status/nyidskwifo4py6ub?svg=true)](https://ci.appveyor.com/project/mcuadros/go-git) [![codecov.io](https://codecov.io/github/src-d/go-git/coverage.svg)](https://codecov.io/github/src-d/go-git) [![Go Report Card](https://goreportcard.com/badge/github.com/src-d/go-git)](https://goreportcard.com/report/github.com/src-d/go-git)\n\n*go-git* is a highly extensible git implementation library written in **pure Go**.\n\nIt can be used to manipulate git repositories at low level *(plumbing)* or high level *(porcelain)*, through an idiomatic Go API. It also supports several types of storage, such as in-memory filesystems, or custom implementations thanks to the [`Storer`](https://godoc.org/gopkg.in/src-d/go-git.v4/plumbing/storer) interface.\n\nIt's being actively developed since 2015 and is being used extensively by [source{d}](https://sourced.tech/) and [Keybase](https://keybase.io/blog/encrypted-git-for-everyone), and by many other libraries and tools.\n\nComparison with git\n-------------------\n\n*go-git* aims to be fully compatible with [git](https://github.com/git/git), all the *porcelain* operations are implemented to work exactly as *git* does.\n\n*git* is a humongous project with years of development by thousands of contributors, making it challenging for *go-git* to implement all the features. You can find a comparison of *go-git* vs *git* in the [compatibility documentation](COMPATIBILITY.md).\n\n\nInstallation\n------------\n\nThe recommended way to install *go-git* is:\n\n```\ngo get -u gopkg.in/src-d/go-git.v4/...\n```\n\n\u003e We use [gopkg.in](http://labix.org/gopkg.in) to version the API, this means that when `go get` clones the package, it's the latest tag matching `v4.*` that is cloned and not the master branch.\n\nExamples\n--------\n\n\u003e Please note that the `CheckIfError` and `Info` functions  used in the examples are from the [examples package](https://github.com/src-d/go-git/blob/master/_examples/common.go#L17) just to be used in the examples.\n\n\n### Basic example\n\nA basic example that mimics the standard `git clone` command\n\n```go\n// Clone the given repository to the given directory\nInfo(\"git clone https://github.com/src-d/go-git\")\n\n_, err := git.PlainClone(\"/tmp/foo\", false, \u0026git.CloneOptions{\n    URL:      \"https://github.com/src-d/go-git\",\n    Progress: os.Stdout,\n})\n\nCheckIfError(err)\n```\n\nOutputs:\n```\nCounting objects: 4924, done.\nCompressing objects: 100% (1333/1333), done.\nTotal 4924 (delta 530), reused 6 (delta 6), pack-reused 3533\n```\n\n### In-memory example\n\nCloning a repository into memory and printing the history of HEAD, just like `git log` does\n\n\n```go\n// Clones the given repository in memory, creating the remote, the local\n// branches and fetching the objects, exactly as:\nInfo(\"git clone https://github.com/src-d/go-siva\")\n\nr, err := git.Clone(memory.NewStorage(), nil, \u0026git.CloneOptions{\n    URL: \"https://github.com/src-d/go-siva\",\n})\n\nCheckIfError(err)\n\n// Gets the HEAD history from HEAD, just like this command:\nInfo(\"git log\")\n\n// ... retrieves the branch pointed by HEAD\nref, err := r.Head()\nCheckIfError(err)\n\n\n// ... retrieves the commit history\ncIter, err := r.Log(\u0026git.LogOptions{From: ref.Hash()})\nCheckIfError(err)\n\n// ... just iterates over the commits, printing it\nerr = cIter.ForEach(func(c *object.Commit) error {\n\tfmt.Println(c)\n\treturn nil\n})\nCheckIfError(err)\n```\n\nOutputs:\n```\ncommit ded8054fd0c3994453e9c8aacaf48d118d42991e\nAuthor: Santiago M. Mola \u003csanti@mola.io\u003e\nDate:   Sat Nov 12 21:18:41 2016 +0100\n\n    index: ReadFrom/WriteTo returns IndexReadError/IndexWriteError. (#9)\n\ncommit df707095626f384ce2dc1a83b30f9a21d69b9dfc\nAuthor: Santiago M. Mola \u003csanti@mola.io\u003e\nDate:   Fri Nov 11 13:23:22 2016 +0100\n\n    readwriter: fix bug when writing index. (#10)\n\n    When using ReadWriter on an existing siva file, absolute offset for\n    index entries was not being calculated correctly.\n...\n```\n\nYou can find this [example](_examples/log/main.go) and many others in the [examples](_examples) folder.\n\nContribute\n----------\n\n[Contributions](https://github.com/src-d/go-git/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) are more than welcome, if you are interested please take a look to\nour [Contributing Guidelines](CONTRIBUTING.md).\n\nLicense\n-------\nApache License Version 2.0, see [LICENSE](LICENSE)\n","funding_links":[],"categories":["校验库","Misc","Uncategorized","Go","Go (134)","Version Control","Software","校验库`用于校验的库`","Libraries","Golang"],"sub_categories":["版本控制","Uncategorized","HTTP Clients","版本控制`版本控制相关库`","Git"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrc-d%2Fgo-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrc-d%2Fgo-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrc-d%2Fgo-git/lists"}