Skip to main content

Syncing your branch in GitHub Desktop

As commits are pushed to your project on GitHub, you can keep your local copy of the project in sync by pulling from the remote repository.

Platform navigation

About branch synchronization

You can sync your local branch with the remote repository by pulling any commits that have been added to the branch on GitHub since the last time you synced. If you make commits from another device or if multiple people contribute to a project, you will need to sync your local branch to keep the branch updated.

When you pull to your local branch, you only update your local copy of the repository. To update your branch on GitHub, you must push your changes. For more information, see "Pushing changes to GitHub from GitHub Desktop."

To add changes from one branch to another branch, you can merge the branches. To apply changes to your branch from another branch in the same repository, you can merge the other branch into your branch on GitHub Desktop. To request that changes from your branch are merged into another branch, in the same repository or in another repository in the network, you can create a pull request on GitHub Desktop. For more information, see "Merging another branch into your project branch" and "Acerca de las solicitudes de incorporación de cambios."

Some workflows require or benefit from rebasing instead of merging. By rebasing you can reorder, edit, or squash commits together. For more information, see "Acerca de la fusión mediante cambio de base de Git" and "Rebasing your project branch onto another branch."

Pulling to your local branch from the remote

  1. In GitHub Desktop, use the Current Branch drop-down, and select the local branch you want to update.

  2. To check for commits on the remote branch, click Fetch origin

    Screenshot of the repository bar. The "Fetch origin" button, displayed with an icon of two arrows forming a circle, is outlined in orange.

  3. To pull any commits from the remote branch, click Pull origin or Pull origin with rebase.

    Screenshot of the repository bar. The "Pull origin" button, displayed with an icon of a downward-facing arrow, is outlined in orange.

  4. Resuelva como prefiera cualquier conflicto de fusión, mediante un editor de texto, la línea de comandos u otra herramienta. Para obtener más información, vea «Cómo abordar los conflictos de combinación».

Merging another branch into your project branch

  1. En GitHub Desktop, haz clic en Rama actual.

    Captura de pantalla de la barra del repositorio. Un botón, con la etiqueta "Rama actual" con una flecha hacia abajo que indica un menú desplegable, se destaca en naranja.

  2. Haz clic en Elegir una rama para combinarla en RAMA.

    Captura de pantalla de la vista desplegable "Rama actual". Debajo de una lista de ramas, un botón con la etiqueta "Elegir una rama para combinarla en my-feature", se destaca en naranja.

  3. Haz clic en la rama que quieres combinar en la rama actual y, a continuación, en Combinar RAMA en RAMA.

    Note: If there are merge conflicts, GitHub Desktop will warn you above the Merge BRANCH into BRANCH button. You will not be able to merge the branches until you have resolved all conflicts.

  4. Para insertar los cambios locales en el repositorio remoto, en la barra del repositorio, haz clic en Insertar origen.

    Captura de pantalla de la barra del repositorio. Un botón, con la etiqueta "Insertar origen", está resaltado con un contorno naranja.

Rebasing your project branch onto another branch

  1. In the menu bar, select Branch, then click Rebase Current Branch.

    Screenshot of the menu bar on a Mac. On the expanded "Branch" dropdown menu, the cursor overs over an option labeled "Rebase Current Branch".

    Screenshot of the "GitHub Desktop" menu bar on Windows. In the expanded "Branch" dropdown menu, an option labeled "Rebase Current Branch" is outlined in orange.

  2. Click the branch you want to rebase into the current branch, then click Rebase.

  3. If you're sure you want to rebase, click Begin Rebase.

  4. Resuelva como prefiera cualquier conflicto de fusión, mediante un editor de texto, la línea de comandos u otra herramienta. Para obtener más información, vea «Cómo abordar los conflictos de combinación».

  5. To push your local changes, click Force push origin.

    Screenshot of the repository bar. A button, labeled "Force push origin" and displayed with an icon of a double upward arrow, is outlined in orange.

Squashing and merging another branch into your project branch

  1. In the menu bar, select Branch, then click Squash and Merge into Current Branch.

    Screenshot of the menu bar on a Mac. On the expanded "Branch" dropdown menu, the cursor hovers over an option labeled "Squash and Merge into Current Branch".

    Screenshot of the "GitHub Desktop" menu bar on Windows. In the expanded "Branch" dropdown menu, option labeled "Squash and merge into curre..." is outlined in orange.

  2. In the "Squash and merge" window, click the branch you want to merge into the current branch, then click Squash and merge.

    Note: If there are merge conflicts, GitHub Desktop will warn you above the Squash and merge button. You will not be able to squash and merge the branch until you have resolved all conflicts.

  3. Para insertar los cambios locales en el repositorio remoto, en la barra del repositorio, haz clic en Insertar origen.

    Captura de pantalla de la barra del repositorio. Un botón, con la etiqueta "Insertar origen", está resaltado con un contorno naranja.

Further Reading