Lesson 6 of 6
Change, test, and deploy end to end
Change the page, run the checks, deploy, and confirm the change is live.
10 minDevOps
After this lesson you will be able to change your site, run the automatic checks, deploy the change, and confirm it is live on your local server.
Make a change to the site
You will change the paragraph on the home page. Open index.html in your text editor and change the paragraph text to something new. For example, change:
<p>This is a simple static website.</p>to:
<p>This is my updated static website.</p>Save the file.
Run the checks
The post-commit hook runs test.sh automatically when you commit. But you can also run the test script yourself before committing. Run:
./test.shThe script checks that the old text is present. Because you changed the paragraph, the test will fail with an error like:
Error: paragraph not found in index.htmlYou need to update the test to match the new text. Open test.sh and change the line that checks for the old paragraph to check for the new one. The line currently is:
if ! grep -q "This is a simple static website." index.html; thenChange it to:
if ! grep -q "This is my updated static website." index.html; thenSave the file. Run the test again:
./test.shNow it should print:
All tests passedCommit the change
Stage both files and commit. The post-commit hook will run the test again and pass.
git add index.html test.shgit commit -m "Update home page text"You should see the commit succeed and the test output from the hook.
Deploy the change
Run the deploy script to package the site and copy it to the public folder:
./deploy.shThis runs package.sh to create a new site.tar.gz, copies it into public/, removes old files there, and extracts the new archive. The script prints:
Created site.tar.gz
Deployed site to public/Confirm the change is live
Start the local web server:
./serve.shOpen http://localhost:8080 in your browser. You should see the updated paragraph. Stop the server with Ctrl+C.
Your working directory should be clean, except for the ignored public/ folder and site.tar.gz. Check with:
git statusYou should see no changes to commit.
Understand the workflow
You have now completed a full cycle: change, test, commit, deploy, verify. This is the core loop for a static site. Each step is small, so you can repeat it often. The test script catches mistakes before they reach the server. The deploy script makes the update repeatable and avoids manual copying errors. The server shows the exact files that were deployed, so you can check the result in a real browser.
When you make a change, always run ./test.sh first. If it fails, fix the test or the site before committing. The post-commit hook is a safety net, but running the test yourself gives faster feedback. After committing, run ./deploy.sh to update the public folder. Then start the server and look at the page. If something is wrong, stop the server, fix the file, and repeat the cycle.
You can also use git log --oneline to see the history of your changes. Each commit should be small and focused. For example, if you change both the heading and the paragraph, you might make two commits: one for the heading and one for the paragraph. This makes it easier to understand what changed and to undo a mistake if needed.
Another useful command is git diff. Before committing, run git diff to see the exact changes you made. This helps you spot accidental edits. For example, if you changed a file by mistake, you can see it in the diff and fix it before committing.
Finally, remember that the public/ folder is ignored by Git. That means the deployed files are not tracked. The source of truth is the files in the my-site folder. The deploy script copies them to public/. If you edit a file directly in public/, it will be overwritten the next time you deploy. Always edit the source files and then deploy.
Key takeaways
- When you change the site, update the test script to match the new expected text.
- Run
./test.shbefore committing to catch failures early. - The post-commit hook runs the test automatically on every commit.
- Use
./deploy.shto package and deploy the site to thepublicfolder. - Start the server with
./serve.shand open the site in your browser to confirm the change.
Try it
Change the heading on the home page from "Welcome to My Site" to "Welcome to My Updated Site". Update test.sh to check for the new heading. Run ./test.sh to confirm it passes. Commit the changes with the message "Update home page heading". Run ./deploy.sh and then ./serve.sh. Open http://localhost:8080 in your browser and verify that the new heading appears. Stop the server with Ctrl+C. Check git status to confirm a clean working directory.
Official documentation
Written with AI and checked automatically. Tools change, so a command may behave differently in the version you install. Spotted a mistake? Tell us.