GIT

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.

git init → first commit git push / git pull .gitignore for Django real project workflows
Tip: Think of Git as a “time machine” for your code – it saves snapshots (commits) so you can track progress and share projects easily.

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
PowerShell — First Git Setup
C:\Your\Project\Folder>
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.

Whenever you make changes to your project, use this short routine:

  1. Check what changedgit status
  2. Stage changesgit add .
  3. Commit with a clear message
  4. Push to GitHub
PowerShell — Daily Git Routine
C:\Your\Project\Folder>
git status
git add .
git commit -m "Short description of changes"
git push

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
PowerShell — New Day Workflow
C:\Your\Project\Folder>
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.

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:

VS Code — .gitignore (Django)
.gitignore
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.

PowerShell — Homework Repo
C:\Users\Alvin\Desktop\İt_step\Homeworks\SyntaxError>
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.

PowerShell — Django Store
C:\Users\Alvin\Desktop\django_web\core>
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.

PowerShell — Cheap_Flight_Finder
C:\Users\Alvin\Desktop\İt_step\apps\Cheap_Flight_Finder>
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

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).

Warning: This deletes the entire .git folder. All commit history will be lost in this local repo.
PowerShell — Remove Git
C:\Your\Project\Folder>
Remove-Item -Recurse -Force .git
Elvin Babanlı
online • quick replies
×
Hi! I’m Elvin. Ask me anything about projects, stack, or your tasks.