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

Making Local and Remote Changes

Congratulations on completing the previous sections! Now, it's time to explore more complex scenarios and learn how to deal with merge conflicts.

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:

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:

Oops, it seems pushing changes failed. What happened is that when we tried to push, Git rejected our changes because the remote repository has updates that our local branch does not. This indicates that we need to sync our local branch with the remote repository before we can push our changes.

Everything was clear?

Section 3. Chapter 1
course content

Course Content

GitHub Fundamentals

Making Local and Remote Changes

Congratulations on completing the previous sections! Now, it's time to explore more complex scenarios and learn how to deal with merge conflicts.

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:

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:

Oops, it seems pushing changes failed. What happened is that when we tried to push, Git rejected our changes because the remote repository has updates that our local branch does not. This indicates that we need to sync our local branch with the remote repository before we can push our changes.

Everything was clear?

Section 3. Chapter 1
some-alt