Skip to content

Instantly share code, notes, and snippets.

@Nuclearfossil
Last active March 17, 2019 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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