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