Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,113 of 9,113 pages
About the help in other languages
All help pages

Keeping a fork in sync with its source

Bring the original's new commits into your fork with git fetch and merge or rebase, resolve conflicts, and keep your own changes small so syncing stays easy - with the commands and a routine.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-5-extend-fork-contribute/keeping-a-fork-in-sync.md

On this page

Keeping a fork in sync with its source

Part 5, chapter 4. A fork starts identical to its original and drifts apart with every commit on either side. The further it drifts, the harder it becomes to take the original's fixes. This chapter shows how to bring the original's changes into your fork, and how to keep that easy.

The commands

With the remotes from Forking on GitHub, step by step (origin your fork, upstream the original):

git fetch upstream
git switch main
git merge --ff-only upstream/main
git push origin main

--ff-only succeeds only when your main has no commits of its own, which is how it should be if you work on branches. If it refuses, you committed to main by mistake: move those commits to a branch first.

GitHub offers the same as a button: Sync fork on your fork's page.

Bringing the original into a branch

Your working branch needs the original's new commits too. Two ways:

# merge: keeps your branch's history as it is, adds a merge commit
git switch fix-menu-entry-csp
git merge upstream/main

# rebase: replays your commits on top of the original's; history stays linear
git switch fix-menu-entry-csp
git rebase upstream/main
git push --force-with-lease origin fix-menu-entry-csp
UseWhen
mergethe branch is shared with others, or already reviewed
rebasethe branch is yours alone and not yet reviewed; many projects prefer pull requests rebased on their current main

Never rebase a branch others have based work on, and never force-push main.

Conflicts

A conflict means the original and you changed the same lines. Git stops and marks them:

<<<<<<< HEAD
<a id="menu-class-change" href="#" data-menu-form="menu-form-class-change">
=======
<a id="menu-class-change" href="#" class="menu-item" onclick="...">
>>>>>>> upstream/main
  1. Read both sides and decide what the line must be. Often it is a combination.
  2. Remove the markers, save, git add the file.
  3. git merge --continue (or git rebase --continue).
  4. Run the extension's tests and open the pages concerned before you push.

A routine for a lasting fork

  • Sync often. Weekly, or on every release of the original. Ten small merges are easier than one large one.
  • Keep your changes few and separate. One commit per change, with a clear message, so you can see in git log what is yours.
  • Send your changes back. Every change the original accepts is one less change you carry (Contributing back with pull requests).
  • Watch the original. On GitHub: Watch > Custom > Releases tells you when to sync.
  • Write down what differs. A short section in your README, "Differences from the original", saves the next maintainer hours.

See how far you have drifted

git fetch upstream
git log --oneline upstream/main..main    # your commits the original does not have
git log --oneline main..upstream/main    # the original's commits you do not have

Two short lists mean a healthy fork. A long first list means you carry a lot: time to send some of it back.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x