0Pricing
Git Advanced: Monorepo, Submodules & Workflows · Lesson

Pushing Changes Back Upstream with Subtree Split

Learn how to extract changes made inside a subtree and push them back to the original upstream repository using git subtree split and push.

Two-Way Subtree Workflows

Subtree is not just for pulling code in. One of its strengths is the ability to contribute changes back to the original project. This makes subtree a genuine two-way integration tool.

The key command is git subtree push, powered internally by git subtree split.

What 'split' Does

git subtree split walks your history and produces a synthetic branch containing only the commits that touched the subtree's prefix, rewritten as if that folder were the repo root.

This is what makes the changes mergeable back upstream.

All lessons in this course

  1. Introduction to Git Subtree
  2. Adding and Merging with Subtree
  3. Subtree vs. Submodule Comparison
  4. Pushing Changes Back Upstream with Subtree Split
← Back to Git Advanced: Monorepo, Submodules & Workflows