- 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
-
Create/move an
index.htmlfile inside your cloned repo.- Example code: You may copy the contents of
empty.htmlin this Gist.
- Example code: You may copy the contents of
-
Check your repo status.
$ git statusYou should see
index.htmlas 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.htmlto track the file with Git (you'll be usingadda lot in your dev life):$ git add index.html- You need to explicitly
addchanges 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 statusYou should see
index.htmlas 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 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.