Skip to main content
Commit actions provide powerful operations for manipulating individual commits in your Git history. These operations allow you to navigate to specific commits, apply changes selectively, and modify your branch’s history.

Checkout Commit

Checkout a specific commit, entering a “detached HEAD” state. Command: checkoutCommit

Parameters

ParameterTypeRequiredDescription
repostringYesPath to the Git repository
commitHashstringYesHash of the commit to check out

Implementation

Executes: git checkout <commitHash>

Response

Returns a status indicating success (null) or an error message if the operation failed.
This puts your repository in a “detached HEAD” state. To make changes permanent, create a new branch from this commit.

Cherry-pick Commit

Apply the changes from a specific commit to the current branch. Command: cherrypickCommit

Parameters

ParameterTypeRequiredDescription
repostringYesPath to the Git repository
commitHashstringYesHash of the commit to cherry-pick
parentIndexnumberYesFor merge commits, specifies which parent to use (0 for non-merge commits)

Implementation

  • Regular commit: git cherry-pick <commitHash>
  • Merge commit: git cherry-pick <commitHash> -m <parentIndex>

Response

Returns a status indicating success (null) or an error message if the operation failed.
The parentIndex parameter is only used for merge commits. For regular commits, set it to 0. For merge commits, use 1 or 2 to specify which parent’s changes to apply.

Revert Commit

Create a new commit that undoes the changes from a specific commit. Command: revertCommit

Parameters

ParameterTypeRequiredDescription
repostringYesPath to the Git repository
commitHashstringYesHash of the commit to revert
parentIndexnumberYesFor merge commits, specifies which parent to use (0 for non-merge commits)

Implementation

  • Regular commit: git revert --no-edit <commitHash>
  • Merge commit: git revert --no-edit <commitHash> -m <parentIndex>

Response

Returns a status indicating success (null) or an error message if the operation failed.
Revert creates a new commit that undoes the changes, preserving history. This is safer than reset for commits that have been shared with others.

Reset to Commit

Reset the current branch to a specific commit. Command: resetToCommit

Parameters

ParameterTypeRequiredDescription
repostringYesPath to the Git repository
commitHashstringYesHash of the commit to reset to
resetMode"soft" | "mixed" | "hard"YesReset mode determining how to handle changes

Reset Modes

  • soft: Moves HEAD to the commit, keeps changes staged
  • mixed: Moves HEAD to the commit, unstages changes but keeps them in working directory
  • hard: Moves HEAD to the commit, discards all changes

Implementation

Executes: git reset --<resetMode> <commitHash>

Response

Returns a status indicating success (null) or an error message if the operation failed.
Using --hard mode will permanently discard all changes after the specified commit. This operation cannot be undone unless you have the commit hashes.

Merge Commit

Merge a specific commit into the current branch. Command: mergeCommit

Parameters

ParameterTypeRequiredDescription
repostringYesPath to the Git repository
commitHashstringYesHash of the commit to merge
createNewCommitbooleanYesIf true, always create a merge commit (uses --no-ff)

Implementation

  • Fast-forward merge: git merge <commitHash>
  • Force merge commit: git merge <commitHash> --no-ff

Response

Returns a status indicating success (null) or an error message if the operation failed.
Setting createNewCommit to true prevents fast-forward merges and always creates a merge commit, making the merge explicit in the history.

Build docs developers (and LLMs) love