Skip to content

Instantly share code, notes, and snippets.

@Nuclearfossil
Last active March 17, 2019 20:30
Show Gist options
  • Save Nuclearfossil/e0f813aed3e4d00c84e0747733c226f6 to your computer and use it in GitHub Desktop.
Save Nuclearfossil/e0f813aed3e4d00c84e0747733c226f6 to your computer and use it in GitHub Desktop.
Git merge upstream process

How to merge an upstream into a fork, by example

Using my glfw branch (https://github.com/Nuclearfossil/glfw forked from https://github.com/glfw/glfw.git) as an example

Ensure that you have the correct upstream

You can use:

$ git remote show upstream
* remote upstream
  Fetch URL: https://github.com/glfw/glfw.git
  Push  URL: https://github.com/glfw/glfw.git
  HEAD branch: master
  Remote branches:
    attach-win32-window     tracked
    capturecursor           tracked
    ci                      tracked
    context-renderer        tracked
    drag-window             tracked
    egldevice               tracked
    get-event-time          tracked
    latest                  tracked
    master                  tracked
    metal-guide             tracked
    new-fullscreen-bugs     tracked
    no-msvcrt               tracked
    preedit-ime             tracked
    rosetta-guide           tracked
    touch                   tracked
    x11-event-time          tracked
    x11-inhibit-screensaver tracked
    xsync                   tracked
  Local ref configured for 'git push':
    master pushes to master (fast-forwardable)

to see if there is an upstream set. It also show where the upstream points to.

If you don't have the upstream set:

git remote add upstream https://github.com/glfw/glfw.git

Merge from Upstream

git fetch upstream git merge upstream/master

Push to your fork

git push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment