Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Remote Branches | Basic Interaction with Remotes
course content

Contenido del Curso

GitHub Fundamentals

Remote Branches Remote Branches

As you have just seen, when working with remotes, there are two types of branches: local and remote.

Remote branches are copies of the branches on the remote repository and are read-only in your local environment.

Let's take a look at the remote branches (-r stands for remote) that our Git repo is currently tracking by running the following command:

To recap, HEAD is a reference to the current commit in your working directory. It points to the latest commit on the current branch you are working on. origin/HEAD is a symbolic reference that points to the default branch of the remote repository. Typically, this is the main branch that the repository considers the primary branch for development.

Since these branches are read-only, you must fetch the changes to your local machine, merge them with your local changes, and then push them back to the remote repository to make changes.

That's all good, but how can we find out whether our current branch is up to date with its remote counterpart? The familiar git status command can help with this; it not only shows the status of your local working directory but also indicates if your branch is ahead, behind, or in sync with the remote branch it tracks.

Let's now run it:

In our case, git status tells us that our local main branch is up to date with origin/main, meaning there are no new changes on the remote main branch that you haven't already included in your local version.

¿Todo estuvo claro?

Sección 2. Capítulo 2
course content

Contenido del Curso

GitHub Fundamentals

Remote Branches Remote Branches

As you have just seen, when working with remotes, there are two types of branches: local and remote.

Remote branches are copies of the branches on the remote repository and are read-only in your local environment.

Let's take a look at the remote branches (-r stands for remote) that our Git repo is currently tracking by running the following command:

To recap, HEAD is a reference to the current commit in your working directory. It points to the latest commit on the current branch you are working on. origin/HEAD is a symbolic reference that points to the default branch of the remote repository. Typically, this is the main branch that the repository considers the primary branch for development.

Since these branches are read-only, you must fetch the changes to your local machine, merge them with your local changes, and then push them back to the remote repository to make changes.

That's all good, but how can we find out whether our current branch is up to date with its remote counterpart? The familiar git status command can help with this; it not only shows the status of your local working directory but also indicates if your branch is ahead, behind, or in sync with the remote branch it tracks.

Let's now run it:

In our case, git status tells us that our local main branch is up to date with origin/main, meaning there are no new changes on the remote main branch that you haven't already included in your local version.

¿Todo estuvo claro?

Sección 2. Capítulo 2
some-alt