Git will create a hidden .git folder — everything is stored there.
Initializing a repository
# Inside your project folder
git init
Git will create a hidden .git folder — everything is stored there.
Configuration (one time only)
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
First commit
# See what has changed
git status
# Add files to the staging area
git add . # all files
git add README.md # a specific file
git add src/ # a folder
# Create the commit
git commit -m "feat: initial project setup"
A common mistake — forgetting .gitignore
Create a .gitignore file BEFORE your first commit:
# Python
__pycache__/
*.pyc
.env
venv/
.venv/
# Django
db.sqlite3
staticfiles/
media/
# IDE
.vscode/
.idea/
git add .gitignore
git commit -m "chore: add .gitignore"
Viewing history
git log # full history
git log --oneline # compact view
git show HEAD # last commit
Connecting to GitHub
# Create a repository on github.com, then:
git remote add origin https://github.com/username/repo.git
git branch -M main
git push -u origin main
Full workflow
# 1. Make your changes
# 2. See what changed
git status
git diff
# 3. Stage and commit
git add .
git commit -m "feat: add task creation form"
# 4. Push to GitHub
git push
💬 Comments (0)
No comments yet
Be the first to share your opinion about this article!