Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Making Local and Remote Changes | More Advanced Workflows
GitHub Fundamentals
course content

Course Content

GitHub Fundamentals

GitHub Fundamentals

1. Introduction to GitHub
2. Basic Interaction with Remotes
3. More Advanced Workflows

book
Making Local and Remote Changes

The next part covers more advanced scenarios and explains how to resolve merge conflicts effectively.

First, let's make a commit directly to our remote repository to simulate collaboration.

We added the following line to the README file using the GitHub interface:

Let's now add a new line to the README file locally. However, this line will be a bit different since we'll specify (local) to identify that these changes were made locally. Before appending a new line and directly committing this change, make sure to switch to the main branch:

Once on the main branch, we can append a new line to the file using the echo command with the >> operator and make a direct commit without explicitly staging the changes:

Note
Note

This command appends the text "A new line (local)" to the end of the README.md file. The >> operator is used to add the text to the file without overwriting its existing content.

Push Attempt

Since the changes are committed locally, it seems all we have to do is run the git push command to push the changes to the remote repository:

Pushing changes failed because the remote repository contains updates not present in the local branch. The local branch must be synchronized with the remote repository before changes can be pushed.

question mark

Why did the git push command fail in this situation?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 1

Ask AI

expand
ChatGPT

Ask anything or try one of the suggested questions to begin our chat

course content

Course Content

GitHub Fundamentals

GitHub Fundamentals

1. Introduction to GitHub
2. Basic Interaction with Remotes
3. More Advanced Workflows

book
Making Local and Remote Changes

The next part covers more advanced scenarios and explains how to resolve merge conflicts effectively.

First, let's make a commit directly to our remote repository to simulate collaboration.

We added the following line to the README file using the GitHub interface:

Let's now add a new line to the README file locally. However, this line will be a bit different since we'll specify (local) to identify that these changes were made locally. Before appending a new line and directly committing this change, make sure to switch to the main branch:

Once on the main branch, we can append a new line to the file using the echo command with the >> operator and make a direct commit without explicitly staging the changes:

Note
Note

This command appends the text "A new line (local)" to the end of the README.md file. The >> operator is used to add the text to the file without overwriting its existing content.

Push Attempt

Since the changes are committed locally, it seems all we have to do is run the git push command to push the changes to the remote repository:

Pushing changes failed because the remote repository contains updates not present in the local branch. The local branch must be synchronized with the remote repository before changes can be pushed.

question mark

Why did the git push command fail in this situation?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 1
We're sorry to hear that something went wrong. What happened?
some-alt