As a student learning programming, I noticed something small but annoying
Every time I worked on a project, I had to type the same Git commands again and again
The thought came to mind is “What if I could push everything with just one command?”
Then comes the "gpush"
🚀 What does gpush do?
With a single command it automatically executes:
1.Checks if Git is installed
2.Verifies you’re inside a Git repository
3.Detects the current branch
4.Pulls the latest changes
5.Adds all modified files
6.Asks for a commit message
7.Commits and pushes safely
8.Stops immediately if an error occurs
All with clear terminal output and basic error handling.
*********************************************
[INFO] Checking Git installation...
*********************************************
*********************************************
[INFO] Checking if inside a Git repository...
*********************************************
*********************************************
[INFO] Current branch: main
*********************************************
*********************************************
[INFO] Pulling latest changes...
*********************************************
[ERROR] Git pull failed (possible merge conflict)
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> main
**
Making terminal output readable
**
I added a simple border system so each step is clear.This made debugging much easier and the output cleaner.
**
🛠️ The core idea (simplified)
**
At the heart of the script is a helper function that runs shell commands and stops safely on errors.
Instead of letting things fail silently, the script exits immediately if something goes wrong (like merge conflicts or missing upstream branches).
That one design choice saved me a lot of confusion.
Small tools build real confidence.
**
đź’¬ Final thoughts
**
If you’re learning programming and feel guilty about not “coding everything from scratch” — don’t.
Understanding, modifying, and improving code is real programming.
Start small. Build tools for yourself.
That’s how it actually begins.
**
đź”— Source code
**
You can find the full script here:
👉 GitHub: https://github.com/Aegis-Specter/git_auotmation
Top comments (0)