Git Extended icon

Git Extended

Run Git commands

Overview

The node "Git Extended" allows users to run various Git commands directly from n8n workflows. It supports a wide range of Git operations such as cloning repositories, creating/deleting branches, committing changes, pushing/pulling from remotes, and more.

For the Delete Branch operation specifically, the node deletes a specified branch from a local Git repository at a given filesystem path.

This node is beneficial in automation scenarios where you want to manage Git repositories programmatically without manual command line intervention. For example:

  • Automatically cleaning up feature branches after merging.
  • Managing branches in CI/CD pipelines.
  • Automating repository maintenance tasks.

Properties

Name Meaning
Repository Path Filesystem path to run the Git command from. For delete branch, this is the local repo path.
Branch Name Name of the branch to delete.
Skip Stdout Whether to ignore the command output to avoid maxBuffer errors (true/false).

Output

The node outputs JSON data with the following structure:

  • stdout: The trimmed standard output from the executed Git command (unless skipped).
  • stderr: The trimmed standard error output from the Git command (unless skipped).

If the Skip Stdout property is enabled, the output JSON will be empty {} to prevent buffer overflow issues when large outputs occur.

No binary data output is produced by this operation.

Example output JSON when not skipping stdout:

{
  "stdout": "Deleted branch feature-branch (was abc1234).",
  "stderr": ""
}

Dependencies

  • Requires a local Git installation accessible via the command line.
  • Uses an API key credential for authentication if needed by other operations (not required for deleting a local branch).
  • No external services are called for the delete branch operation; it runs Git commands locally.

Troubleshooting

  • Common Issues:

    • Trying to delete a branch that does not exist will cause Git to return an error.
    • Deleting the currently checked-out branch is not allowed by Git and will fail.
    • Insufficient permissions on the filesystem path can cause command failures.
  • Error Messages:

    • "Command failed with exit code X": Indicates the Git command returned an error. Check the branch name and repository path.
    • "Unsupported operation deleteBranch": Means the operation was not recognized, likely due to misconfiguration.
    • Buffer overflow errors may occur if output is large; enable Skip Stdout to mitigate.
  • Resolutions:

    • Verify the branch name exists and is not currently checked out.
    • Ensure the repository path is correct and accessible.
    • Use the Skip Stdout option if encountering buffer size errors.

Links and References

Discussion