Commit to Repo

Commit to Repo

Visual Studio Marketplace Version Visual Studio Marketplace Installs Visual Studio Marketplace Rating Visual Studio Marketplace DeepScan grade vsmarketplace Average time to resolve an issue Percentage of issues still open Mightora.io

The Commit to Repo Extension is a streamlined tool designed to automate the process of committing changes made during a pipeline run to your Git repository.

Created by:

Mightora Logo

Setup

  • Install the DevOps extension in your DevOps Organization using the Get it free button.
  • Navigate to your pipeline.
  • Add the commitToRepo task to your pipeline.
  • Ensure your pipeline has the System.AccessToken variable enabled.

Support

Please visit mightora.io

Key Features

Commit To Git Repository

Overview

This task automates committing changes made during a pipeline run to your Git repository, ensuring everything is pushed automatically.

Key Features

  • Automated Git Commits: Stages and commits all modifications to the Git repository.
  • Selective Folder Commits: Optionally target specific folders for commits, or commit all changes.
  • Secure Authentication: Uses the pipeline’s System.AccessToken for authentication.
  • Customizable Commit Message: Specify a commit message via the task’s input parameters.
  • Flexible Configuration: Set up Git configurations like user email and name.

How to Use

  1. Add the task to your Azure DevOps pipeline.
  2. Specify the commit message using the commitMsg input.
  3. Ensure your pipeline has the System.AccessToken variable enabled.
  4. Run the pipeline to commit and push changes to the repository.

Input Parameters

ParameterRequiredDefaultDescription
commitMsgYes-The commit message for the changes
branchNameYesmainThe branch name to commit to
tagsNo-Comma-separated list of tags to add to the commit
targetFolderNo-Specific folder(s) to commit changes from. Supports multiple folders separated by commas. Can be relative (e.g., docs) or absolute path (e.g., $(Build.SourcesDirectory)/wiki-output). If empty, all changes will be committed.
createOrphanBranchNofalseIf checked, creates an orphan branch (no history) containing ONLY the specified target folders. Useful for creating branches with specific files and no connection to main repository history. Only works when targetFolder is specified.
pushStrategyYesnormalChoose how to push: Normal (standard push), Force Push (overwrites remote), or Delete and Recreate (deletes then recreates remote branch).

Example Pipeline Usage

# Example 1: Commit all changes
- task: mightoraCommitToRepo@2
  inputs:
    commitMsg: "Automated commit from pipeline"
    branchName: "main"

# Example 2: Commit changes from specific folder (relative path)
- task: mightoraCommitToRepo@2
  inputs:
    commitMsg: "Updated documentation"
    branchName: "docs-update"
    targetFolder: "docs"

# Example 3: Commit changes from specific folder (absolute path)
- task: mightoraCommitToRepo@2
  inputs:
    commitMsg: "Updated wiki output"
    branchName: "wiki-update"
    targetFolder: "$(Build.SourcesDirectory)/wiki-output"

# Example 4: Commit with tags
- task: mightoraCommitToRepo@2
  inputs:
    commitMsg: "Release version 1.0.0"
    branchName: "main"
    tags: "v1.0.0, release"

# Example 5: Create orphan branch with only specific folders (no history)
- task: mightoraCommitToRepo@2
  inputs:
    commitMsg: "Wiki documentation only"
    branchName: "wiki-only"
    targetFolder: "wiki-output"
    createOrphanBranch: true
    pushStrategy: "normal"

# Example 6: Force push to overwrite remote branch
- task: mightoraCommitToRepo@2
  inputs:
    commitMsg: "Updated wiki content"
    branchName: "wiki-output"
    targetFolder: "$(Build.SourcesDirectory)/wiki-output"
    createOrphanBranch: true
    pushStrategy: "force"

# Example 7: Delete and recreate branch (clean slate)
- task: mightoraCommitToRepo@2
  inputs:
    commitMsg: "Fresh wiki branch"
    branchName: "word-output"
    targetFolder: "wiki-output, docs"
    createOrphanBranch: true
    pushStrategy: "deleteAndRecreate"