IMPORTANT! In this course, you generally should NOT edit the GitHub repo directly. I do it here only for the convenience of demonstration. I would not actually work this way!
Browse to the GitHub repo home page, and switch it to the main
branch (if it is not already on that branch).
Scroll down to the README portion of the page (below the file explorer).
Click the pencil button to edit the README.
In the web-based text editor, replace the contents of the README with the following:
# Git Activity App
This app is purely an example for practicing Git commands on.
To save your edits, click the Commit changes… button (found near the upper right of the text editor pane).A Commit changes modal form window will appear. Click the Commit changes button at the bottom of the form. (There is no need to change any of the form fields or settings.)
Browse back to the GitHub repo home page, and confirm that the README file has been updated.
Note that a new “Update README.md” commit has now been added to the GitHub repo.
In the terminal, run the gloga
command.
Note that the “Update README.md” commit does NOT appear in the version history.
To download the latest data from the remote GitHub repo, run the fetch command:
git fetch
Run the gloga
command.
Note that the “Update README.md” commit now appears as the latest commit in the version history. Also note that the remote branch origin/main
is now ahead of the local branch main
. This means that, although you have downloaded the latest commit to your local repo, the remote branch has not yet been merged into your local main
branch.
To merge the remote branch origin/main
into your local branch main
, first, switch to the main
branch (if you are not already on that branch):
git switch main
Then, perform the merge:
git pull
Note that a fast-forward merge was performed.
Run the gloga
command.
Note that the local branch main
has now caught up with the remote branch origin/main
.
In VS Code, open the README.md
file.
Note that the updates made to README.md
in GitHub have now been added to the local branch main
.
Be aware that the git pull
command above actually performed a sequence of two commands:
git fetch
git merge origin/main
It is technically possible to run these two commands manually; however, git pull
is generally more convenient.
Congratulations! You have completed the activity.