- Create a GitHub repository
- Clone a GitHub repository
- Add an empty webpage to a local repo
- Commit changes to
index.html. pushchanges to GitHub.- Deploy your GitHub repo to GitHub Pages.
-
You see
nothing to commit, working tree cleanwhen you check your repo status:$ git status
-
Using your code editor (VS Code, for example), make a change to
index.html(or some other file) and save the file.- For example: update the
<title>ofindex.html.
- For example: update the
-
Check the status of your repo:
$ git statusGit notices you've changed a file.
Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: index.html no changes added to commit (use "git add" and/or "git commit -a") -
Notice Git is telling us what to do next (add changes with
add):$ git add index.html- You need to explicitly
addchanges before they can be committed later, because Git.
- You need to explicitly
-
Let's check our status again:
$ git statusOur changes are now "staged" (i.e. ready to be committed):
Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: index.html -
Commit your staged changes:
$ git commit -m "updated page title"Git will save your changes as a snapshot of your project.
[main 169a1b0] added index.html 1 file changed, 11 insertions(+) create mode 100644 index.html- Warning: Commit messages are mandatory. If you omit
-m "some commit message", your terminal will openvimor some other command line text editor. Worst case: close your terminal window and open another one.
- Warning: Commit messages are mandatory. If you omit
-
Confirm the status of your repo:
$ git statusYou should see
nothing to commit, working tree clean.
- Make more changes! Repeat the above steps until they become comfortable. For example:
- Add/update a
<p>in the<body>ofindex.html; - Add/edit embedded CSS in the
<head>ofindex.htmlusing<style> - Link an external CSS file in the
<head>ofindex.htmlusing</link>.
- Add/update a
- When you're ready, push your changes to GitHub.