I Lost My University Project a Few Hours Before Demo Day — That’s How I Learned Git
A few years ago, I learned one of the most important lessons of my software engineering journey the hard way.
Just a few hours before my university project exhibition, I was fixing what seemed like a small bug. Instead of solving the problem, I accidentally corrupted a significant portion of my project's backend files.
I had no backup.
No version history.
No recovery plan.
At that time, Git and GitHub were just words I had heard from senior developers. I never thought I needed them.
That day, I could only demonstrate the frontend of my project while the backend remained broken.
The experience taught me something every developer eventually learns:
Your code is not truly safe until it is version-controlled.
This article is the guide I wish I had back then.
What Is Git?
Git is a distributed version control system.
In simple terms, Git tracks changes in your project over time.
Think of it as a timeline for your code.
Instead of saving files like:
- project-final
- project-final-v2
- project-final-v2-latest
- project-final-v2-latest-actual-final
Git maintains a complete history of every meaningful change.
Benefits:
- Recover deleted code
- Compare versions
- Collaborate with others
- Experiment safely
- Track project history
What Is GitHub?
Many beginners think Git and GitHub are the same thing.
They are not.
Git = Version control software running on your computer.
GitHub = Cloud platform that hosts Git repositories.
Think of it this way:
Git is your notebook.
GitHub is the cloud storage where that notebook is safely stored and shared.
Why Every Developer Needs Git
Imagine these situations:
- You accidentally delete important code.
- A new feature breaks everything.
- Your laptop crashes.
- A teammate introduces a bug.
- You want to return to a previous working version.
Without Git:
You panic.
With Git:
You simply restore a previous commit.
Installing Git
Windows:
Download Git from the official Git website.
Verify installation:
git --version
Expected output:
git version 2.x.x
Creating Your First Repository
Create a project folder:
mkdir my-project
cd my-project
Initialize Git:
git init
Output:
Initialized empty Git repository
Git is now tracking this folder.
Understanding the Git Workflow
Most beginners struggle because they don't understand Git's three stages.
Working Directory
Where you create and edit files.
Staging Area
Where you prepare changes for saving.
Repository
Where Git permanently stores snapshots.
Workflow:
Edit Files
↓
git add
↓
Staging Area
↓
git commit
↓
Repository History
Your First Commit
Create a file:
touch app.py
Check status:
git status
Stage the file:
git add app.py
Commit changes:
git commit -m "Initial commit"
Congratulations.
You have created your first checkpoint.
Essential Git Commands
Check Status
git status
Shows:
- Modified files
- Staged files
- Untracked files
View History
git log
Displays all commits.
Compact view:
git log --oneline
Compare Changes
git diff
Shows what changed before committing.
Remove File from Staging
git restore --staged filename
Understanding Branches
A branch is an independent line of development.
Imagine building a new feature without touching the main project.
That's exactly what branches allow.
Create branch:
git branch login-feature
Switch branch:
git checkout login-feature
Modern shortcut:
git switch login-feature
Create and switch:
git switch -c login-feature
Why Branches Matter
Without branches:
You experiment directly on production code.
With branches:
You can make mistakes safely.
Professional developers rarely work directly on the main branch.
Merging Branches
After finishing a feature:
Switch to main:
git switch main
Merge feature:
git merge login-feature
Git combines both histories.
Understanding Merge Conflicts
Conflicts occur when two versions modify the same lines.
Example:
Developer A changes line 10.
Developer B changes line 10.
Git cannot decide automatically.
You must manually choose which version to keep.
This is normal.
Even experienced engineers handle merge conflicts regularly.
Connecting Git to GitHub
Create a repository on GitHub.
Connect local repository:
git remote add origin repository-url
Verify:
git remote -v
Push Code to GitHub
git push -u origin main
Your code is now stored online.
This single command could have saved my university project years ago.
Clone Existing Repositories
Copy a repository:
git clone repository-url
Git downloads the entire project history.
Pull Latest Changes
git pull origin main
Updates your local project.
Forking Open Source Projects
Forking creates your own copy of someone else's repository.
Typical workflow:
- Fork repository
- Clone fork
- Create branch
- Make changes
- Push changes
- Open Pull Request
This is how many developers contribute to open source.
Pull Requests
A Pull Request (PR) is a request to merge changes.
Benefits:
- Code review
- Discussion
- Collaboration
- Quality assurance
Professional teams rely heavily on PRs.
Git Ignore
Some files should never be tracked.
Examples:
- Passwords
- API keys
- Build files
- Temporary files
Create:
.gitignore
Example:
node_modules/
.env
dist/
Commit Message Best Practices
Bad:
fixed stuff
Good:
Add user authentication system
Great commits tell a story.
Future you will appreciate them.
GitHub Features Every Developer Should Use
Issues
Track bugs and tasks.
Projects
Manage development workflows.
Discussions
Community conversations.
Actions
Automate testing and deployment.
Releases
Publish stable versions.
GitHub Actions
GitHub can automatically:
- Run tests
- Build projects
- Deploy applications
Every time code is pushed.
This is called CI/CD.
A basic workflow:
name: Test Project
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Common Beginner Mistakes
Not Committing Frequently
Commit small changes often.
Working Only on Main
Use feature branches.
Forgetting .gitignore
Never upload secrets.
Ignoring Pull Requests
Code reviews improve quality.
No Remote Backup
Always push to GitHub.
From Beginner to Professional
A beginner uses Git to save code.
An intermediate developer uses Git to collaborate.
An advanced engineer uses Git to manage complex software systems.
The commands are important.
The mindset is more important.
Version control is not about memorizing commands.
It is about building with confidence.
Final Thoughts
The day I lost my university project taught me a lesson I will never forget.
Git is not just a developer tool.
GitHub is not just a website.
Together, they form a safety net that protects your work, enables collaboration, and gives you the confidence to experiment without fear.
If you are learning software development today, start using Git and GitHub immediately.
Trust me.
It is far better to learn from this article than from losing a project a few hours before demo day.
Top comments (0)