public class Git extends Object implements AutoCloseable
The GitPorcelain commands are described in the Git Documentation.
 This class only offers methods to construct so-called command classes. Each
 GitPorcelain command is represented by one command class.
 Example: this class offers a commit() method returning an instance of
 the CommitCommand class. The CommitCommand class has setters
 for all the arguments and options. The CommitCommand class also has a
 call method to actually execute the commit. The following code show's
 how to do a simple commit:
 
 Git git = new Git(myRepo);
 git.commit().setMessage("Fix393").setAuthor(developerIdent).call();
 
 All mandatory parameters for commands have to be specified in the methods of
 this class, the optional parameters have to be specified by the
 setter-methods of the Command class.
 This class is intended to be used internally (e.g. by JGit tests) or by external components (EGit, third-party tools) when they need exactly the functionality of a GitPorcelain command. There are use-cases where this class is not optimal and where you should use the more low-level JGit classes. The methods in this class may for example offer too much functionality or they offer the functionality with the wrong arguments.
| Constructor and Description | 
|---|
Git(Repository repo)
Constructs a new  
Git object which can interact with the specified
 git repository. | 
| Modifier and Type | Method and Description | 
|---|---|
AddCommand | 
add()
Returns a command object to execute a  
Add command | 
ApplyCommand | 
apply()
Returns a command object to execute a  
apply command | 
ArchiveCommand | 
archive()
Returns a command to create an archive from a tree 
 | 
BlameCommand | 
blame()
Returns a command object to execute a  
blame command | 
CreateBranchCommand | 
branchCreate()
Returns a command object used to create branches 
 | 
DeleteBranchCommand | 
branchDelete()
Returns a command object used to delete branches 
 | 
ListBranchCommand | 
branchList()
Returns a command object used to list branches 
 | 
RenameBranchCommand | 
branchRename()
Returns a command object used to rename branches 
 | 
CheckoutCommand | 
checkout()
Returns a command object to execute a  
checkout command | 
CherryPickCommand | 
cherryPick()
Returns a command object to execute a  
cherry-pick command | 
CleanCommand | 
clean()
Returns a command object to execute a  
clean command | 
static CloneCommand | 
cloneRepository()
Returns a command object to execute a  
clone command | 
void | 
close()
Frees resources associated with this instance. 
 | 
CommitCommand | 
commit()
Returns a command object to execute a  
Commit command | 
DescribeCommand | 
describe()
Returns a command object to come up with a short name that describes a
 commit in terms of the nearest git tag. 
 | 
DiffCommand | 
diff()
Returns a command object to execute a  
diff command | 
FetchCommand | 
fetch()
Returns a command object to execute a  
Fetch command | 
GarbageCollectCommand | 
gc()
Returns a command object to execute a  
gc command | 
Repository | 
getRepository()  | 
static InitCommand | 
init()
Returns a command object to execute a  
init command | 
LogCommand | 
log()
Returns a command object to execute a  
Log command | 
LsRemoteCommand | 
lsRemote()
Returns a command object to execute a  
ls-remote command | 
static LsRemoteCommand | 
lsRemoteRepository()
Returns a command to list remote branches/tags without a local
 repository. 
 | 
MergeCommand | 
merge()
Returns a command object to execute a  
Merge command | 
NameRevCommand | 
nameRev()
Returns a command object to find human-readable names of revisions. 
 | 
AddNoteCommand | 
notesAdd()
Returns a command to add notes to an object 
 | 
ListNotesCommand | 
notesList()
Returns a command to list all notes 
 | 
RemoveNoteCommand | 
notesRemove()
Returns a command to remove notes on an object 
 | 
ShowNoteCommand | 
notesShow()
Returns a command to show notes on an object 
 | 
static Git | 
open(File dir)  | 
static Git | 
open(File dir,
    FS fs)  | 
PullCommand | 
pull()
Returns a command object to execute a  
Pull command | 
PushCommand | 
push()
Returns a command object to execute a  
Push command | 
RebaseCommand | 
rebase()
Returns a command object to execute a  
Rebase command | 
ReflogCommand | 
reflog()
Returns a command object to execute a  
reflog command | 
ResetCommand | 
reset()
Returns a command object to execute a  
reset command | 
RevertCommand | 
revert()
Returns a command object to execute a  
revert command | 
RmCommand | 
rm()
Returns a command object to execute a  
rm command | 
StashApplyCommand | 
stashApply()
Returns a command object used to apply a stashed commit 
 | 
StashCreateCommand | 
stashCreate()
Returns a command object used to create a stashed commit 
 | 
StashDropCommand | 
stashDrop()
Returns a command object used to drop a stashed commit 
 | 
StashListCommand | 
stashList()
Returns a command object used to list stashed commits 
 | 
StatusCommand | 
status()
Returns a command object to execute a  
status command | 
SubmoduleAddCommand | 
submoduleAdd()
Returns a command object to execute a  
submodule add command | 
SubmoduleInitCommand | 
submoduleInit()
Returns a command object to execute a  
submodule init command | 
SubmoduleStatusCommand | 
submoduleStatus()
Returns a command object to execute a  
submodule status command | 
SubmoduleSyncCommand | 
submoduleSync()
Returns a command object to execute a  
submodule sync command | 
SubmoduleUpdateCommand | 
submoduleUpdate()
Returns a command object to execute a  
submodule update command | 
TagCommand | 
tag()
Returns a command object to execute a  
Tag command | 
DeleteTagCommand | 
tagDelete()
Returns a command object used to delete tags 
 | 
ListTagCommand | 
tagList()
Returns a command object used to list tags 
 | 
String | 
toString()  | 
static Git | 
wrap(Repository repo)  | 
public Git(Repository repo)
Git object which can interact with the specified
 git repository.
 All command classes returned by methods of this class will always interact with this git repository.
 The caller is responsible for closing the repository; close() on
 this instance does not close the repo.
repo - the git repository this class is interacting with;
            null is not allowed.public static Git open(File dir) throws IOException
dir - the repository to open. May be either the GIT_DIR, or the
            working tree directory that contains .git.Git object for the existing git repositoryIOExceptionpublic static Git open(File dir, FS fs) throws IOException
dir - the repository to open. May be either the GIT_DIR, or the
            working tree directory that contains .git.fs - filesystem abstraction to use when accessing the repository.Git object for the existing git repository. Closing this
         instance will close the repo.IOExceptionpublic static Git wrap(Repository repo)
public void close()
 If the repository was opened by a static factory method in this class, then
 this method calls Repository.close() on the underlying repository
 instance. (Whether this actually releases underlying resources, such as
 file handles, may vary; see Repository for more details.)
 
 If the repository was created by a caller and passed into Git(Repository) or a static factory method in this class, then this
 method does not call close on the underlying repository.
 
 In all cases, after calling this method you should not use this Git
 instance anymore.
close in interface AutoCloseablepublic static CloneCommand cloneRepository()
clone commandCloneCommand used to collect all optional parameters
         and to finally execute the clone commandpublic static LsRemoteCommand lsRemoteRepository()
LsRemoteCommandpublic static InitCommand init()
init commandInitCommand used to collect all optional parameters and
         to finally execute the init commandpublic CommitCommand commit()
Commit commandCommitCommand used to collect all optional parameters
         and to finally execute the Commit commandpublic LogCommand log()
Log commandLogCommand used to collect all optional parameters and
         to finally execute the Log commandpublic MergeCommand merge()
Merge commandMergeCommand used to collect all optional parameters
         and to finally execute the Merge commandpublic PullCommand pull()
Pull commandPullCommandpublic CreateBranchCommand branchCreate()
CreateBranchCommandpublic DeleteBranchCommand branchDelete()
DeleteBranchCommandpublic ListBranchCommand branchList()
ListBranchCommandpublic ListTagCommand tagList()
ListTagCommandpublic RenameBranchCommand branchRename()
RenameBranchCommandpublic AddCommand add()
Add commandAddCommand used to collect all optional parameters and
         to finally execute the Add commandpublic TagCommand tag()
Tag commandTagCommand used to collect all optional parameters and
         to finally execute the Tag commandpublic FetchCommand fetch()
Fetch commandFetchCommand used to collect all optional parameters
         and to finally execute the Fetch commandpublic PushCommand push()
Push commandPushCommand used to collect all optional parameters and
         to finally execute the Push commandpublic CherryPickCommand cherryPick()
cherry-pick commandCherryPickCommand used to collect all optional
         parameters and to finally execute the cherry-pick commandpublic RevertCommand revert()
revert commandRevertCommand used to collect all optional parameters
         and to finally execute the cherry-pick commandpublic RebaseCommand rebase()
Rebase commandRebaseCommand used to collect all optional parameters
         and to finally execute the rebase commandpublic RmCommand rm()
rm commandRmCommand used to collect all optional parameters and
         to finally execute the rm commandpublic CheckoutCommand checkout()
checkout commandCheckoutCommand used to collect all optional parameters
         and to finally execute the checkout commandpublic ResetCommand reset()
reset commandResetCommand used to collect all optional parameters
         and to finally execute the reset commandpublic StatusCommand status()
status commandStatusCommand used to collect all optional parameters
         and to finally execute the status commandpublic ArchiveCommand archive()
ArchiveCommandpublic AddNoteCommand notesAdd()
AddNoteCommandpublic RemoveNoteCommand notesRemove()
RemoveNoteCommandpublic ListNotesCommand notesList()
ListNotesCommandpublic ShowNoteCommand notesShow()
ShowNoteCommandpublic LsRemoteCommand lsRemote()
ls-remote commandLsRemoteCommand used to collect all optional parameters
         and to finally execute the status commandpublic CleanCommand clean()
clean commandCleanCommand used to collect all optional parameters
         and to finally execute the clean commandpublic BlameCommand blame()
blame commandBlameCommand used to collect all optional parameters
         and to finally execute the blame commandpublic ReflogCommand reflog()
reflog commandReflogCommand used to collect all optional parameters
         and to finally execute the reflog commandpublic DiffCommand diff()
diff commandDiffCommand used to collect all optional parameters and
         to finally execute the diff commandpublic DeleteTagCommand tagDelete()
DeleteTagCommandpublic SubmoduleAddCommand submoduleAdd()
submodule add commandSubmoduleAddCommand used to add a new submodule to a
         parent repositorypublic SubmoduleInitCommand submoduleInit()
submodule init commandSubmoduleInitCommand used to initialize the
         repository's config with settings from the .gitmodules file in
         the working treepublic SubmoduleStatusCommand submoduleStatus()
submodule status commandSubmoduleStatusCommand used to report the status of a
         repository's configured submodulespublic SubmoduleSyncCommand submoduleSync()
submodule sync commandSubmoduleSyncCommand used to update the URL of a
         submodule from the parent repository's .gitmodules filepublic SubmoduleUpdateCommand submoduleUpdate()
submodule update commandSubmoduleUpdateCommand used to update the submodules in
         a repository to the configured revisionpublic StashListCommand stashList()
StashListCommandpublic StashCreateCommand stashCreate()
StashCreateCommandpublic StashApplyCommand stashApply()
StashApplyCommandpublic StashDropCommand stashDrop()
StashDropCommandpublic ApplyCommand apply()
apply commandApplyCommand used to collect all optional parameters
         and to finally execute the apply commandpublic GarbageCollectCommand gc()
gc commandGarbageCollectCommand used to collect all optional
         parameters and to finally execute the gc commandpublic NameRevCommand nameRev()
NameRevCommand.public DescribeCommand describe()
DescribeCommand.public Repository getRepository()
close() for notes on closing this repository.Copyright © 2015 Eclipse JGit Project. All rights reserved.