- Create a GitHub repository
- Clone a GitHub repository
- Add an empty webpage to a local repo
- Commit changes to
index.html
. push
changes to GitHub.- Deploy your GitHub repo to GitHub Pages.
-
You see
nothing to commit, working tree clean
when you check your repo status:$ git status
-
Create/move an
index.html
file inside your cloned repo.- Example code: You may copy the contents of
empty.html
in this Gist.
- Example code: You may copy the contents of
-
Check your repo status.
$ git status
You should see
index.html
as an untracked file:On branch main Your branch is up to date with 'origin/main'. Untracked files: (use "git add <file>..." to include in what will be committed) index.html nothing added to commit but untracked files present (use "git add" to track)
-
Add
index.html
to track the file with Git (you'll be usingadd
a lot in your dev life):$ git add index.html
- You need to explicitly
add
changes before they can be committed later, because Git.
- You need to explicitly
-
Check your repo status (you can never check your repo status enough).
$ git status
You should see
index.html
as a new file to be committed:On branch main Your branch is up to date with 'origin/main'. Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: index.html
-
Commit your new file:
$ git commit -m "added index.html"
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 openvim
or 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 status
You should see
nothing to commit, working tree clean
.