Once you have a Repository instance, you can do all sorts of things with it. The first line gets a pointer to the master reference. You can get the name. The second line gets the target of the master reference, which is returned as an ObjectId instance. The third line is similar, but shows how JGit handles the rev-parse syntax for more on this, see Branch References ; you can pass any object specifier that Git understands, and JGit will return either a valid ObjectId for that object, or null.
The next two lines show how to load the raw contents of an object. In this example, we call ObjectLoader. For large objects where. The next few lines show what it takes to create a new branch. We create a RefUpdate instance, configure some parameters, and call. Directly following this is the code to delete that same branch. Note that. Some of the actions of JGit can be executed on a remote repository but for most methods you have to have a local copy.
The Git class has a static method that allows you to clone a remote repository. JGits commands are lazily evaluated to allow for configuration via method chaining. The call of Class call starts the execution of the command. By default, JGit only clones the default branch. It is also possible to tell JGit to clone a specific branch. If you want to directly create a repository object you can use the FileRepositoryBuilder. The following example, creates a new Git repostory, creates a few files, branches and extracts information for the repo.
This example assume that you have org. This example shows how to amend a commit with JGit. The code retrieves the HEAD of a repository and changes its commit and author date.
JGit Maven Repository. If you need more assistance we offer Online Training and Onsite training as well as consulting. Production of Eclipse features and p2 repository for JGit. See the JGit Wiki on why and how to use this module. Native symbolic links are supported, provided the file system supports them. CRLF conversion is performed depending on the core. If Git is not installed, use the global or repository configuration for the core. The system wide configuration file is located relative to where C Git is installed.
There are other options like Eclipse settings that can be used for pointing out where C Git is installed. On Windows this is often not the same value as the user. Walk the history from a given set of commits looking for commits introducing changes in files under a specified path. Fetch via ssh, git, http, Amazon S3 and bundles. Push via ssh, git, http, and Amazon S3. JGit does not yet deltify the pushed packs so they may be a lot larger than C Git packs. Post questions, comments or discussions to the jgit-dev eclipse.
You need to be subscribed to post.
0コメント