Estás contribuyendo a un proyecto de código abierto y notaste que tu fork (bifurcación) no está sincronizada con el repositorio original. ¿Cómo puedes corregir eso?

Versión TL;DR (muy largo; no lo leí)

# Agregar un nuevo repositorio upstream remoto
git remote add upstream https://github.com/PROPIETARIO_ORIGINAL/REPOSITORIO_ORIGINAL.git

# Sincroniza tu Fork
git fetch upstream
git checkout master
git merge upstream/master

Agregar un nuevo repositorio upstream remoto

Clonaste el fork en tu computadora y comenzaste a trabajar en el problema.

¿Sabías que tu fork es huérfano? Si enlistas el repositorio remoto configurado, solo verás a tu fork como origen:

git remote -v
origin  https://github.com/TU_USUARIO/TU_FORK.git (fetch)
origin  https://github.com/TU_USUARIO/TU_FORK.git (push)

¡No hay señales de padres! ¿Dónde está el repositorio original?

Necesitamos configurar esta información para restaurar la relación familiar agregando un nuevo repositorio remoto upstream:

git remote add upstream https://github.com/PROPIETARIO_ORIGINAL/REPOSITORIO_ORIGINAL.git

¡Salvaste a la familia! Ahora puedes ver tanto el repositorio original como al fork:

git remote -v
origin    https://github.com/TU_USUARIO/TU_FORK.git (fetch)
origin    https://github.com/TU_USUARIO/TU_FORK.git (push)
upstream  https://github.com/PROPIETARIO_ORIGINAL/REPOSITORIO_ORIGINAL.git (fetch)
upstream  https://github.com/PROPIETARIO_ORIGINAL/REPOSITORIO_ORIGINAL.git (push)

Sincroniza tu fork

Ahora todo está configurado. Puedes sincronizar tu fork con solo 2 comandos.

Asegúrate de estar en la raíz de tu proyecto y también en la rama maestra. De lo contrario, puedes consultar en la sucursal maestra:

git checkout master
Switched to branch 'master'

Ahora, debes buscar los cambios del repositorio original:

git fetch upstream
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 7 (delta 5), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), 1.72 Kio | 160.00 Kio/s, done.
From https://github.com/PROPIETARIO_ORIGINAL/REPOSITORIO_ORIGINAL
   909ef5a..0b228a8  master     -> upstream/master

Y fusiona los cambios en tu rama maestra:

git merge upstream/master
Updating 909ef5a..0b228a8
Fast-forward
 node.js/WorkingWithItems/batch-get.js               | 51 ++++++++++++++++++++++++++------------------------
 node.js/WorkingWithItems/batch-write.js             | 95 +++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------
 node.js/WorkingWithItems/delete-item.js             | 37 ++++++++++++++++++------------------
 node.js/WorkingWithItems/get-item.js                | 31 +++++++++++++++++--------------
 node.js/WorkingWithItems/put-item-conditional.js    | 51 +++++++++++++++++++++++++-------------------------
 node.js/WorkingWithItems/put-item.js                | 49 ++++++++++++++++++++++++------------------------
 node.js/WorkingWithItems/transact-get.js            | 51 ++++++++++++++++++++++++++------------------------
 node.js/WorkingWithItems/transact-write.js          | 79 ++++++++++++++++++++++++++++++++++++++++-------------------------------------
 node.js/WorkingWithItems/update-item-conditional.js | 51 ++++++++++++++++++++++++++------------------------
 node.js/WorkingWithItems/update-item.js             | 47 ++++++++++++++++++++++++----------------------
 10 files changed, 282 insertions(+), 260 deletions(-)

¡Eso es! Tu fork  ahora está actualizada.

¿Alguna pregunta? ¡No dudes en contactar a Johan en Twitter!

Traducido del artículo de Johan Rin-How to Sync Your Fork with the Original Git Repository