|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.jgit.api.Git
public class Git
Offers a "GitPorcelain"-like API to interact with a git repository.
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 Summary | |
|---|---|
Git(Repository repo)
Constructs a new Git object which can interact with the specified
git repository. |
|
| Method Summary | |
|---|---|
AddCommand |
add()
Returns a command object to execute a Add command |
ApplyCommand |
apply()
Returns a command object to execute a apply command |
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 |
CommitCommand |
commit()
Returns a command object to execute a Commit command |
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 |
MergeCommand |
merge()
Returns a command object to execute a Merge command |
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 |
static Git |
wrap(Repository repo)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
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.
repo - the git repository this class is interacting with.
null is not allowed| Method Detail |
|---|
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 repository
IOException
public 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
IOExceptionpublic static Git wrap(Repository repo)
repo - the git repository this class is interacting with.
null is not allowed
Git object for the existing git repositorypublic static CloneCommand cloneRepository()
clone command
CloneCommand used to collect all optional parameters
and to finally execute the clone commandpublic static InitCommand init()
init command
InitCommand used to collect all optional parameters and
to finally execute the init commandpublic CommitCommand commit()
Commit command
CommitCommand used to collect all optional parameters
and to finally execute the Commit commandpublic LogCommand log()
Log command
LogCommand used to collect all optional parameters and
to finally execute the Log commandpublic MergeCommand merge()
Merge command
MergeCommand used to collect all optional parameters
and to finally execute the Merge commandpublic PullCommand pull()
Pull command
PullCommandpublic CreateBranchCommand branchCreate()
CreateBranchCommandpublic DeleteBranchCommand branchDelete()
DeleteBranchCommandpublic ListBranchCommand branchList()
ListBranchCommandpublic ListTagCommand tagList()
ListTagCommandpublic RenameBranchCommand branchRename()
RenameBranchCommandpublic AddCommand add()
Add command
AddCommand used to collect all optional parameters and
to finally execute the Add commandpublic TagCommand tag()
Tag command
TagCommand used to collect all optional parameters and
to finally execute the Tag commandpublic FetchCommand fetch()
Fetch command
FetchCommand used to collect all optional parameters
and to finally execute the Fetch commandpublic PushCommand push()
Push command
PushCommand used to collect all optional parameters and
to finally execute the Push commandpublic CherryPickCommand cherryPick()
cherry-pick command
CherryPickCommand used to collect all optional
parameters and to finally execute the cherry-pick commandpublic RevertCommand revert()
revert command
RevertCommand used to collect all optional parameters
and to finally execute the cherry-pick commandpublic RebaseCommand rebase()
Rebase command
RebaseCommand used to collect all optional parameters
and to finally execute the rebase commandpublic RmCommand rm()
rm command
RmCommand used to collect all optional parameters and
to finally execute the rm commandpublic CheckoutCommand checkout()
checkout command
CheckoutCommand used to collect all optional parameters
and to finally execute the checkout commandpublic ResetCommand reset()
reset command
ResetCommand used to collect all optional parameters
and to finally execute the reset commandpublic StatusCommand status()
status command
StatusCommand used to collect all optional parameters
and to finally execute the status commandpublic AddNoteCommand notesAdd()
AddNoteCommandpublic RemoveNoteCommand notesRemove()
RemoveNoteCommandpublic ListNotesCommand notesList()
ListNotesCommandpublic ShowNoteCommand notesShow()
ShowNoteCommandpublic LsRemoteCommand lsRemote()
ls-remote command
LsRemoteCommand used to collect all optional parameters
and to finally execute the status commandpublic CleanCommand clean()
clean command
CleanCommand used to collect all optional parameters
and to finally execute the clean commandpublic BlameCommand blame()
blame command
BlameCommand used to collect all optional parameters
and to finally execute the blame commandpublic ReflogCommand reflog()
reflog command
ReflogCommand used to collect all optional parameters
and to finally execute the reflog commandpublic DiffCommand diff()
diff command
DiffCommand used to collect all optional parameters and
to finally execute the diff commandpublic DeleteTagCommand tagDelete()
DeleteTagCommandpublic SubmoduleAddCommand submoduleAdd()
submodule add command
SubmoduleAddCommand used to add a new submodule to a
parent repositorypublic SubmoduleInitCommand submoduleInit()
submodule init command
SubmoduleInitCommand used to initialize the
repository's config with settings from the .gitmodules file in
the working treepublic SubmoduleStatusCommand submoduleStatus()
submodule status command
SubmoduleStatusCommand used to report the status of a
repository's configured submodulespublic SubmoduleSyncCommand submoduleSync()
submodule sync command
SubmoduleSyncCommand used to update the URL of a
submodule from the parent repository's .gitmodules filepublic SubmoduleUpdateCommand submoduleUpdate()
submodule update command
SubmoduleUpdateCommand 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 command
ApplyCommand used to collect all optional parameters
and to finally execute the apply commandpublic GarbageCollectCommand gc()
gc command
GarbageCollectCommand used to collect all optional
parameters and to finally execute the gc commandpublic Repository getRepository()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||