Git & GitHub — Student-Friendly Guide
This page collects all your Git notes in one place: from initializing a repository to pushing real projects like Cheap_Flight_Finder and Django Store.
Overview
When you start a Git-enabled project for the very first time, you need to:
- Initialize Git in your project folder
- Track files
- Make the first commit
- Connect to GitHub and push
git init
git status
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/your-username/your-repo.git
git branch -M main
git push -u origin main
This prepares your local folder and uploads it to your GitHub repository for the first time.
Daily workflow
Whenever you make changes to your project, use this short routine:
- Check what changed —
git status - Stage changes —
git add . - Commit with a clear message
- Push to GitHub
git status
git add .
git commit -m "Short description of changes"
git push
Morning routine
When you come back to a project another day, always:
- Go to the project folder
- Activate virtual environment (if you use one)
- Pull from GitHub first (very important)
- Then continue with coding and normal Git steps
cd project-folder
venv\Scripts\activate # if needed
git pull origin main
git status
git add .
git commit -m "Today's updates"
git push
Rule: always git pull before starting new work, especially if you use the same repo on multiple computers.
Why .gitignore?
Some files should never go to GitHub: virtual environments, cache files, local databases,
secrets and editor config. For a Django project, a simple .gitignore can look like this:
venv/
__pycache__/
*.pyc
*.pyo
*.pyd
*.sqlite3
*.log
.vscode/
.env
*.env
.DS_Store
Thumbs.db
This keeps your repository clean and protects sensitive data like environment variables.
📌 Example 1 – Python Homework Push (SyntaxError folder)
Single file homework pushed to GitHub.
cd "C:\Users\Alvin\Desktop\İt_step\Homeworks\SyntaxError"
git init
git add module_branching_statements_part_1.py
git commit -m "day_3"
git push -u origin main
📌 Example 2 – Django Store Project
Full Django project pushed to a GitHub repo.
cd C:\Users\Alvin\Desktop\django_web\core
git init
git add .
git commit -m "Initial Django store project"
git remote add origin https://github.com/elvin-babanli/Django-store.git
git branch -M main
git push -u origin main
📌 Example 3 – Cheap Flight Finder (with .env in .gitignore)
Python app with API keys safely ignored using .env.
cd "C:\Users\Alvin\Desktop\İt_step\apps\Cheap_Flight_Finder"
git init
echo .env > .gitignore
# add safe ignores
.env
__pycache__/
.vscode/
*.pyc
git add app.py .gitignore
git commit -m "Added app.py and .gitignore"
git remote add origin https://github.com/elvin-babanli/Cheap_Flight_Finder.git
git branch -M main
git push -u origin main
Danger zone
Sometimes you might want to completely remove Git tracking from a folder (for example, to re-init or if you accidentally initialized in the wrong place).
.git folder.
All commit history will be lost in this local repo.
Remove-Item -Recurse -Force .git