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, committing changes, pushing and pulling branches, managing branches, applying patches, and specifically for this request, rebasing branches.

The Rebase operation lets you rebase the current branch onto another specified upstream branch. This is useful in scenarios where you want to integrate changes from one branch into another by replaying commits on top of the upstream branch, helping maintain a cleaner project history.

Practical example:
You have a feature branch that has diverged from the main branch. Before merging, you want to rebase your feature branch onto the latest main branch to incorporate recent changes and resolve conflicts early.

Properties

Name Meaning
Repository Path Filesystem path where the Git command will be executed. For clone, the repository is created inside this path. Default is "." (current directory).
Upstream Branch The branch name onto which the current branch will be rebased. This property is required for the Rebase operation.
Skip Stdout Boolean flag indicating whether to ignore the command's standard output. Useful to avoid maxBuffer errors when output is large. Defaults to false.

Output

The node outputs JSON data containing the results of the executed Git command:

  • If Skip Stdout is false (default), the output JSON includes:

    • stdout: The trimmed standard output of the Git command.
    • stderr: The trimmed standard error output of the Git command.
  • If Skip Stdout is true, the output JSON will be empty {} because the command output is ignored to prevent buffer overflow issues.

No binary data output is produced by this node.

Dependencies

  • Requires Git to be installed and accessible in the system environment where n8n runs.
  • Uses Node.js child process utilities to execute Git commands.
  • Requires an API key credential for authentication if operations like clone, push, or pull are used with authentication enabled.
  • No additional external services are needed for the Rebase operation.

Troubleshooting

  • Common issues:

    • Incorrect repository path: Ensure the Repository Path points to a valid Git repository.
    • Invalid or non-existent upstream branch: The Upstream Branch must exist in the repository.
    • Permission issues: Make sure the user running n8n has filesystem permissions to access the repository path.
    • Large output causing maxBuffer errors: Enable Skip Stdout to avoid these errors.
  • Error messages:

    • Unsupported operation rebase: Indicates the operation name was not recognized; ensure the operation is set correctly.
    • Command failed with exit code X: The underlying Git command failed; check the stderr output for details.
    • Failed to parse the repository URL: Occurs during clone operation with authentication; verify the repository URL format.

Links and References

Discussion