**************************************************************************** Copyright 2016 Andreea Mocanu & Alexandru Mocanu Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ****************************************************************************
| Modifiers | Name | Description |
|---|---|---|
enum |
GitRepo.Relation |
| Type | Name and description |
|---|---|
java.lang.Iterable<java.lang.String> |
allAncestorTags()@return All the tags in the repository that belong to ancestors of HEAD, including HEAD itself. |
java.lang.Iterable<java.lang.String> |
allTags()@return All the tags in the repository. |
GitRepo.Relation |
branchToBranchRelation(java.lang.String firstBranch, java.lang.String secondBranch)@param firstBranch |
java.lang.Iterable<java.lang.String> |
centralBranches()@return All names of branches that remote-track branches on the central repository. |
java.lang.Iterable<java.lang.String> |
changes()@return All changes in the repository (staged and unstaged). |
void |
checkoutBranch(java.lang.String branchName)Checks out the branch with the given name. |
void |
close()Call this to release underlying resources. |
java.lang.String |
commitIdOfBranch(java.lang.String branchName)@param branchName |
java.lang.String |
commitIdOfTag(java.lang.String tagName)@param tagName |
void |
commitSingleFile(java.lang.String file, java.lang.String commitMessage)Creates a commit consisting only of the given file, if possible. |
void |
createLocalAndRemoteBranch(java.lang.String branchName, java.lang.String startPoint)Creates a local branch with the given name, starting from the given point, and a branch with the same name in the central repository, tracked by the local branch. |
void |
createLocalBranch(java.lang.String branchName, java.lang.String startPoint)Creates a non-tracking branch with the given name, starting from the given point. |
void |
createLocalBranchTrackingRemote(java.lang.String branchName, java.lang.String remoteBranchName)Creates a local branch with the given name, starting from the given remote branch and tracking it. |
void |
createTag(java.lang.String tagName)Creates a tag with the given name. |
java.lang.String |
currentBranch()@return The name of the currently checked-out branch, or null if repository is in detached head. |
void |
fastForwardCurrentBranchTo(java.lang.String someOtherBranch)Merges the given branch into the currently checked-out branch in fast-forward-only mode. |
void |
fetchAllBranchesAndPrune()Fetches all the branches in the central repository, pruning all the remote-tracking branches that no longer exist on the central repository. |
void |
fetchAllTags()Fetches all the tags from the central repository. |
void |
fetchBranches(java.lang.Iterable<java.lang.String> branchNames)Fetches only the branches with the given names from the central repository. |
boolean |
isCentralBranch(java.lang.String branchName)@param branchName |
boolean |
isDetachedHead()@return true if the repository is in the detached head state,
false otherwise |
boolean |
isLocalBranch(java.lang.String branchName)@param branchName |
boolean |
isLocalBranchTrackingRemoteBranch(java.lang.String branchName, java.lang.String remoteBranchName)@param branchName |
boolean |
isTag(java.lang.String tagName)@param tagName |
java.lang.Iterable<java.lang.String> |
localBranches()@return All local branch names. |
void |
pushBranchToCentral(java.lang.String branchName)Pushed the given branch to the central repository. |
void |
pushBranchToCentralWithTags(java.lang.String branchName)Pushed the given branch to the central repository together with any existing tags. |
void |
pushTagsToCentral()Pushes all the tags to the central repository. |
void |
removeBranch(java.lang.String branchName)Removes the branch with the given name from the repository. |
void |
removeBranchOnCentral(java.lang.String branchName)Removes the branch with the given name from the central repository. |
void |
resetCurrentBranchToCommit(java.lang.String commitId)Resets the currently checked-out branch to the commit with the given id in the local repository. |
java.lang.String |
rootDir()The absolute path of the repository. |
java.lang.Iterable<java.lang.String> |
stagedChanges()@return All staged changes in the repository. |
java.lang.Iterable<java.lang.String> |
unstagedChanges()@return All unstaged changes in the repository. |
Checks out the branch with the given name. Does nothing if already checked out.
Call this to release underlying resources. No operation must be performed on the GitRepo instance after this method is called.
Creates a commit consisting only of the given file, if possible. If the file is unstaged, it adds it to the staging area first. If the file is unchanged, or if there are other changes beside this file, throws an exception.
file - The path of the file to be committed, relative to the repository rootcommitMessage - A commit messageCreates a local branch with the given name, starting from the given point, and a branch with the same name in the central repository, tracked by the local branch.
startPoint - A branch name, a tag or a commit idCreates a non-tracking branch with the given name, starting from the given point.
startPoint - A branch name, a tag or a commit idCreates a local branch with the given name, starting from the given remote branch and tracking it.
Creates a tag with the given name.
null if repository is in detached head.Merges the given branch into the currently checked-out branch in fast-forward-only mode. Throws exception if fast-forward is not possible.
Fetches all the branches in the central repository, pruning all the remote-tracking branches that no longer exist on the central repository. No tags are fetched.
Fetches all the tags from the central repository. No branches are fetched.
Fetches only the branches with the given names from the central repository.
true, if the given name belongs to a branch on the central repository,
false, otherwise
true if the repository is in the detached head state,
false otherwise
true, if the given name belongs to a local branch,
false, otherwise
true if the given branch is tracking the given remote branch
false otherwise
true if the repository has a tag with the given name,
false otherwise
Pushed the given branch to the central repository.
Pushed the given branch to the central repository together with any existing tags.
Pushes all the tags to the central repository.
Removes the branch with the given name from the repository.
Removes the branch with the given name from the central repository.
branchName - The name of a branch in the central repository.Resets the currently checked-out branch to the commit with the given id in the local repository.
The absolute path of the repository.