| Modifier and Type | Field and Description |
|---|---|
| pack-priv final org. | |
| pack-priv String | |
| pack-priv String | |
| pack-priv static final Logger | |
| pack-priv final Path | |
| pack-priv final File |
| Access | Constructor and Description |
|---|---|
| public | GitHandler(Path
The root of the initialized git repository repositoryPath)Initialize the handler for the given repository |
| Modifier and Type | Method and Description |
|---|---|
| public void | checkoutBranch(String
Name of the branch to check out branchToCheckout)Checkout the branch with the specified name, if it does not exist create it |
| public boolean | Returns: Returns true if a new commit was created. This is the case if the repository was not clean on method invocationWhether to amend to the last commit (true), or not (false) amend)Creates a commit on the currently checked out branch |
| public String | |
| pack-priv Optional | getRefForBranch(String branchName)
Returns the reference of the specified branch If it does not exist returns an empty optional |
| pack-priv boolean | isGitRepository()
Returns true if the given path points to a directory that is a git repository (contains a .git folder) |
| public void | mergeBranches(String
the name of the branch that is merged into targetBranch, String the name of the branch that gets merged sourceBranch, org.Merges the source branch into the target branch |
| public void | |
| public void | pushCommitsToRemoteRepository()
Pushes all commits made to the branch that is tracked by the currently checked out branch. |
| pack-priv void |
| credentialsProvider | back to summary |
|---|---|
| pack-priv final org. | |
| gitPassword | back to summary |
|---|---|
| pack-priv String gitPassword | |
| gitUsername | back to summary |
|---|---|
| pack-priv String gitUsername | |
| LOGGER | back to summary |
|---|---|
| pack-priv static final Logger LOGGER | |
| repositoryPath | back to summary |
|---|---|
| pack-priv final Path repositoryPath | |
| repositoryPathAsFile | back to summary |
|---|---|
| pack-priv final File repositoryPathAsFile | |
| GitHandler | back to summary |
|---|---|
| public GitHandler(Path repositoryPath) Initialize the handler for the given repository
| |
| checkoutBranch | back to summary |
|---|---|
| public void checkoutBranch(String branchToCheckout) throws IOException, org.eclipse.jgit.api.errors.GitAPIException Checkout the branch with the specified name, if it does not exist create it
| |
| createCommitOnCurrentBranch | back to summary |
|---|---|
| public boolean createCommitOnCurrentBranch(String commitMessage, boolean amend) throws IOException, org.eclipse.jgit.api.errors.GitAPIException Creates a commit on the currently checked out branch
| |
| getCurrentlyCheckedOutBranch | back to summary |
|---|---|
| public String getCurrentlyCheckedOutBranch() throws IOException | |
| getRefForBranch | back to summary |
|---|---|
| pack-priv Optional Returns the reference of the specified branch If it does not exist returns an empty optional | |
| isGitRepository | back to summary |
|---|---|
| pack-priv boolean isGitRepository() Returns true if the given path points to a directory that is a git repository (contains a .git folder) | |
| mergeBranches | back to summary |
|---|---|
| public void mergeBranches(String targetBranch, String sourceBranch, org. Merges the source branch into the target branch | |
| pullOnCurrentBranch | back to summary |
|---|---|
| public void pullOnCurrentBranch() throws IOException | |
| pushCommitsToRemoteRepository | back to summary |
|---|---|
| public void pushCommitsToRemoteRepository() throws IOException Pushes all commits made to the branch that is tracked by the currently checked out branch. If pushing to remote fails, it fails silently. | |
| setupGitIgnore | back to summary |
|---|---|
| pack-priv void setupGitIgnore() | |