Prompt file imported from KrasherPlay/maksym_tupis_ki_2023_lpnu_ua (
.github/prompts/git-init.prompt.md). Fill in{{projectRoot}},{{branchName}}before use. Copyright stays with the author.
Initialize version control for the Java/Maven project at {{projectRoot}}.
Procedure
- Inspect the project root and determine whether it is already a Git repository.
- Inspect existing files and working-tree state before making changes.
- If Git is absent, run
git initand create or update.gitignorewith Java/Maven entries (target/, IDE metadata, logs, and local environment files). - If a repository already exists, preserve it; do not reinitialize it or discard changes.
- Create or verify the requested default branch
{{branchName}}only when this can be done without rewriting history. - Never add secrets, credentials, private keys, generated artifacts, or local configuration containing sensitive values.
- Do not commit unless the user explicitly requests a commit.
Success criteria
- The project is a valid Git repository.
- Existing files and uncommitted changes are preserved.
.gitignoreexcludes Maven build output and common local-only files.git status --shortcompletes successfully.
Failure handling
If any command fails, stop immediately, report the command and safe remediation, and do not continue to the next pipeline stage.
