Git + GitHub + Cloudflare

Command reference — what to run and when

Workflow 1

Start a brand new project

Run once when setting up a new site for the first time.

cd ~/Desktop/your-site-folder    # go into the folder
git init                         # tell Git to start tracking this folder
git add index.html               # stage the file
git commit -m "initial commit"   # save a snapshot
gh repo create your-site-name --public --source=. --push  # create repo on GitHub and push

Then connect to Cloudflare once in the browser — Compute → Workers & Pages → Create application → "Looking to deploy Pages? Get started" → Import Git repository → select repo → leave build settings blank → Save and Deploy.

Workflow 2

Push an update live

Run every time you've edited a file and want it to go live.

cd ~/Desktop/your-site-folder
git add index.html               # stage the change
git commit -m "describe change"  # save a snapshot with a label
git push                         # send to GitHub → Cloudflare auto-deploys

Live within ~30 seconds of the push.

Workflow 3

See all saved versions

Run when you want to see your version history and get commit IDs.

cd ~/Desktop/your-site-folder
git log --oneline                # shows short ID + label for each version

Output looks like: 5eed8ef update greeting / fd4cf35 initial commit

Workflow 4

Restore a specific old version

Run when you want to go back to how the file looked at a past point. Use the 7-character ID from git log --oneline.

cd ~/Desktop/your-site-folder
git checkout [commit-id] -- index.html  # pull the file from that snapshot
git commit -m "restore [version]"       # save it as a new snapshot
git push                                # go live

Rule: Use the ID of the version you want, not the one after it. Do not try to revert the very first commit — it errors.

Workflow 5

Sync local file after editing on GitHub

Run after making any change directly on GitHub (e.g. restoring a version via the browser UI) so your Desktop file matches.

cd ~/Desktop/your-site-folder
git pull                         # pull latest from GitHub down to your machine
How it fits together

The three layers

Changes always flow left to right. You edit locally, push to GitHub, Cloudflare picks it up.


Your Desktop
Edit files here
~/Desktop/your-site
GitHub
Version history
git push
Cloudflare
Live website
auto-deploys on push