When it breaks, go back
If a change ruins your project, Git can show what changed and help you return to an earlier working version.
Git is a tool that saves the history of your project. It lets you try new things, break code, compare changes, and roll back when something does not work.
GitHub is the website and developer community where people store, share, and collaborate on code. It can host public portfolio projects or private work-in-progress repos.
Before Git, a lot of people saved projects like this:
final, final2, final-real, final-real-fixed.
Git is the better version of that.
If a change ruins your project, Git can show what changed and help you return to an earlier working version.
New layout? New function? Different config? Try it on a branch. If it fails, throw it away.
Good commit messages tell the story of how a project was built, fixed, cleaned up, and improved.
These are related, but they are not the same thing.
| Concept | Plain English | Why it matters |
|---|---|---|
| Git | The version control tool on your computer or in Codespaces. | Tracks changes, commits snapshots, creates branches, and lets you roll back. |
| GitHub | A Microsoft-owned website and platform for storing and sharing Git repositories. | Lets you back up code online, collaborate, use Codespaces, build portfolios, and share projects. |
| Repository | A project folder with Git history. | A repo can hold code, notes, images, configs, docs, assignments, and project files. |
| Commit | A saved snapshot of your project. | Each commit should represent one meaningful change. |
| Branch | A separate line of work. | Use branches to try new ideas without damaging the main version. |
| Push | Upload your commits to GitHub. | This backs up your work and lets other people see it if the repo is public. |
Git is the tool that makes “try new things” safer.
Write code, create files, make configs, and get something working.
Commit a working version before you make risky changes.
Use branches to test ideas without damaging the main version.
Keep the good changes, throw away the bad ones, and document what happened.
Most beginner Git work follows the same pattern.
See what files changed before saving anything.
Choose which changes should go into the next snapshot.
Save a snapshot with a short message explaining the change.
Upload the saved work to GitHub.
git status
git add .
git commit -m "Add first project page"
git push
These are enough to start using Git for class projects.
| Command | Plain English | Use it when |
|---|---|---|
git status |
Show what changed. | Run this constantly. It tells you what Git sees. |
git diff |
Show the actual line-by-line changes. | Use before committing so you know what you are saving. |
git add file |
Stage a file for the next commit. | Use when you want to save a specific file. |
git add . |
Stage everything in the current folder. | Useful for simple beginner projects, but review with git status first. |
git commit -m "message" |
Save a snapshot. | Use after a meaningful change works. |
git log --oneline |
Show commit history. | Use to see your project timeline. |
git switch -c experiment |
Create and switch to a new branch. | Use before trying a risky idea. |
git restore file |
Throw away unsaved changes to one file. | Use when you changed a file and want the last committed version back. |
git push |
Upload commits to GitHub. | Use to back up your work online. |
git pull |
Download the latest changes. | Use before working if the GitHub copy may be newer. |
GitHub is not just storage. It is a public technical notebook, a collaboration tool, and a project portfolio.
If your computer dies, your GitHub repos can still hold the project history.
A clean public repo can prove you can write code, document work, use Git, and finish projects.
You can read open-source code, file issues, contribute fixes, and see how professional projects are organized.
GitHub Codespaces can give you a Linux-based coding environment in the browser.
Create repos for Java, Python, C++, databases, and web projects so every class has a clean workspace.
A good README can turn a pile of code into a project someone else can understand.
This rule keeps things simple.
Use private repos while you are still figuring things out, doing class assignments, storing rough notes, or working with files that might contain sensitive information.
Make a repo public when it is cleaned, documented, and safe to show. Public projects can help with resumes, internships, clubs, and interviews.
GitHub is useful, but it is very easy to accidentally publish things you should not publish.
Do not commit .env files, API keys, SSH private keys, database passwords, or cloud credentials.
Some instructors do not want assignment solutions public. Keep coursework private unless sharing is allowed.
Remove real IP addresses, usernames, emails, customer data, private notes, logs, and screenshots with sensitive info.
# Example .gitignore entries
.env
*.pem
*.key
secrets/
config.local.json
__pycache__/
.venv/
node_modules/
This is a practical student workflow.
Goal: set up one GitHub repo and Codespace for every class that gives code files.
This is the smallest useful Git practice lab.
Goal: create a tiny project, commit it, break it, and restore it.
git-practice.git init.notes.txt.git diff to see the damage.git restore notes.txt to roll back the uncommitted change.mkdir git-practice
cd git-practice
git init
echo "Git lets me save project history." > notes.txt
git status
git add notes.txt
git commit -m "Add first note"
echo "broken change" >> notes.txt
git diff
git restore notes.txt
cat notes.txt
A commit message should say what changed. It does not need to be fancy.
Git is not just for professional software developers. It changes how you work.
Trying something new is less scary when rollback exists.
Every class, project, and experiment can have a clean history.
A good public repo shows real skill better than just saying you know something.
These are the official and beginner-friendly links I would keep nearby.
Official Git book section explaining version control and why it exists.
GitHub’s beginner explanation of Git, history, commits, and collaboration.
Official GitHub page explaining repositories and public/private visibility.
Official GitHub guidance for when sensitive data was committed.
Hands-on GitHub practice courses for issues, pull requests, pages, and more.
Use GitHub Codespaces to practice Git and terminal commands without installing a compiler.
Git makes experimentation safer. GitHub makes finished work easier to store, share, and show. Keep rough work private, sanitize before publishing, and use public repos as proof that you can build real things.