Class GitFlow
java.lang.Object
io.github.jbastgen.stemma.gitflow.GitFlow
The Git Flow branching model on top of a
GitRepository: start and finish features, releases and
hotfixes, with the same rules as the git flow command line tool.
Finishing is built from idempotent steps (merge, tag, back-merge, delete). If a merge stops on conflicts it
stays in progress so it can be resolved with the normal commit workflow; calling finish(io.github.jbastgen.stemma.gitflow.Kind, java.lang.String, io.github.jbastgen.stemma.gitflow.FinishOptions) again then
skips what is done and completes the rest.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconfig()The effective configuration:gitflow.*keys, with conventional defaults for what is not set.facts(GitFlowConfig config) What the repository looks like for the plan: branches, remote branches, commits and the keys written now.finish(Kind kind, String name, FinishOptions options) Finishes the branch<prefix><name>of the given kind.voidinitialize(GitFlowConfig config) Sets Git Flow up: stores the configuration and creates the development branch from the production branch if it does not exist yet.voidinitializeNew(GitFlowConfig config, String initialMessage) Sets Git Flow up in a repository that has no commit yet (a new one): branches cannot exist before the first commit, so an empty initial commit is made on the production branch, the development branch is created from it, the configuration is stored and the development branch is checked out.booleanWhether both long-lived branches exist, so features, releases and hotfixes can be started.The kind of a branch name, judged by its prefix.openBranches(Kind kind) Names of the existing local branches of this kind, sorted, with their prefix.planInitialize(GitFlowConfig config, boolean initialCommit) Whatinitialize(io.github.jbastgen.stemma.gitflow.GitFlowConfig)would do with this configuration, and what is wrong with it; reads the repository, changes nothing.Starts a feature, release or hotfix and switches to its new branch.
-
Constructor Details
-
GitFlow
public GitFlow(io.github.jbastgen.stemma.git.api.GitRepository repo) - Parameters:
repo- the repository to work on; it stays open and is not closed here
-
-
Method Details
-
config
The effective configuration:gitflow.*keys, with conventional defaults for what is not set. -
isInitialized
public boolean isInitialized()Whether both long-lived branches exist, so features, releases and hotfixes can be started. -
planInitialize
Whatinitialize(io.github.jbastgen.stemma.gitflow.GitFlowConfig)would do with this configuration, and what is wrong with it; reads the repository, changes nothing. -
facts
What the repository looks like for the plan: branches, remote branches, commits and the keys written now. -
initialize
Sets Git Flow up: stores the configuration and creates the development branch from the production branch if it does not exist yet. Safe to call on an initialised repository. -
initializeNew
Sets Git Flow up in a repository that has no commit yet (a new one): branches cannot exist before the first commit, so an empty initial commit is made on the production branch, the development branch is created from it, the configuration is stored and the development branch is checked out. In a repository that already has commits it does whatinitialize(io.github.jbastgen.stemma.gitflow.GitFlowConfig)does and leaves the checked-out branch alone.- Parameters:
initialMessage- the message of the initial commit- Throws:
io.github.jbastgen.stemma.git.api.GitException- if the repository is still on another branch than the production branch
-
openBranches
Names of the existing local branches of this kind, sorted, with their prefix. -
kindOf
The kind of a branch name, judged by its prefix. -
start
Starts a feature, release or hotfix and switches to its new branch.- Parameters:
name- feature name or version number, without the prefix- Returns:
- the name of the new branch
- Throws:
io.github.jbastgen.stemma.git.api.GitException- if a precondition is not met (the message says which)
-
finish
Finishes the branch<prefix><name>of the given kind.
-