Course Content
GitHub Fundamentals
GitHub Fundamentals
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:
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.
Thanks for your feedback!