This post may contains affiliate links. As an amazon associate I earn from qualifying purchases.
If you’re like me, sometimes you open your project after a month and think:
“Wait… did I set up Git for this? Did I mess up my code? How do I even check?”
Don’t worry — you’re not alone. Git is powerful, but you don’t need to know all of it to be safe and productive. Here’s the minimal Git workflow that keeps your code safe, easy to track, and easy to roll back.
1. Why you need Git
Even if your app “just works,” Git gives you:
✅ A snapshot of your working code
✅ The ability to see what changed
✅ A safety net if something breaks
✅ Confidence to experiment
Think of Git as a time machine for your code.
2. The minimal commands you actually need
You really only need a few commands to stay safe:
| Command | Purpose |
|---|---|
git status | Check what has changed since last commit |
git diff | See line-by-line changes before committing |
git add . | Stage all changes for commit |
git commit -m "message" | Save a snapshot of your code |
git log --oneline | See a history of all commits |
git restore . | Undo uncommitted changes safely |
That’s it — nothing more is required to stay safe.
3. Step 0: Check if Git is initialized
Go to your project folder and run:
If it says
fatal: not a git repository, run:
If you see branch info, you’re good — Git is tracking your project.
4. Step 1: Check your last commit
The top line is the most recent commit.
This tells you what code was last saved safely.
5. Step 2: Compare your desktop code with the last commit
If it says
nothing to commit, working tree clean→ your code matches the last commit.If it lists files → those files are different from the last commit.
For details:
Shows exactly what changed line by line.
Safe to just look — doesn’t alter anything.
6. Step 3: Save a safe snapshot
Whenever you’re about to do something risky (like adding a new feature):
Example:
Now you have a restore point if anything goes wrong.
7. Step 4: Undo changes safely (if needed)
If you want to discard uncommitted changes:
Your code goes back to exactly how it was at the last commit.
Optional older method:
8. Step 5: Use a feature flag for new code
Before touching risky code:
Keep your old code untouched
Add the new feature behind a flag:
Flip it only when ready
This avoids breaking your working app
9. The simple Git workflow to memorize
Check status →
git statusSee what changed →
git diffStage changes →
git add .Commit changes →
git commit -m "message"See history →
git log --oneline
✅ That’s it. Repeat every time before major changes.
10. Bonus tip: Internal testing for apps
For mobile apps (Flutter, Android, iOS), never test risky changes in production.
Use internal test channels (Google Play Internal Testing / TestFlight).
Combine this with Git snapshots for a completely safe workflow.
Conclusion
Git doesn’t have to be complicated. With just 6 commands and a simple workflow, you can:
Track your code
Safely try new features
Roll back if something breaks
Sleep at night knowing your code is safe
TL;DR:
git status → git diff → git add . → git commit -m "message" → git log --oneline → git restore .
That’s all you need to survive, thrive, and ship safely.
This post may contains affiliate links. As an amazon associate I earn from qualifying purchases.