-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[concept] JGit tutorial #72
Labels
Comments
Example SnippetsDirectly create a repo object
Create a Git object based on Repository
Check out a specific commitThe example shows how to check out a specific commit. This leaves you in a detatched HEAD state.
check out a commit and create a new branch with this commit
Searching and accessing a file
|
Summary of info that we need:
Questions to figure out:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
References
Add Maven Dependencies
API
Repository
A Repository holds all objects and refs used for managing source code. To build a repo, you invoke flavors of
RepositoryBuiilder
:Git Objects
All objects are represented by a
SHA-1
id in the Git object model. In JGit, this is represented by theAnyObjectId
andObjectId
classes.There are four types of objects in the Git object model:
blob
: is used to store file datatree
: can be thought of as a dir, it references other trees and blobscommit
: a commit points to a single treetag
: marks a commit as special; generally used to mark specific releasesTo resolve an object from a repo, simply pass in the right revision string
Ref
A
Ref
is a variable that holds a single object identifier. The object identifier can be valid Git object (blob, tree, commit, tag). For example, to query for the references to head, you can simply callRevWalk
A
RevWalk
walks a commit graph and produces the matching commits in orderRevCommit
A
RevCommit
represents a commit in the Git object model. To parse a commit, simply use aRevWalk
instance:RevTag
A
RevTag
represents a tag in the Git object model. to parse a tag, simply use aRevWalk
instance:RevTree
A
RevTree
represents a tree in the Git object model. To parse a tree, simply use aRevWalk
instance:The text was updated successfully, but these errors were encountered: