Git and Version Control: The Essential Developer Tool
"I changed this file yesterday, I need the old version but I didn't save it." — If you've ever said this, Git is for you. Git is a version control system that records every change to your code and lets you go back to any point in time.
What Is Git?
Git is a distributed version control system developed by Linus Torvalds (creator of Linux) in 2005. 96% of software developers worldwide use Git.
Why Should You Use Git?
1. Change History
- Every change is recorded (commit)
- You can go back to any point in time
- See who changed what and when
2. Team Collaboration
- Multiple people can work simultaneously
- Conflicts are manageable
- Code review processes
- Controlled merging via pull requests
3. Parallel Development
- Work on different features simultaneously with branches
- Experiment without breaking main code
- Feature branches, hotfix branches
4. Backup
- Code is stored in multiple places
- Code is safe even if your computer breaks
- GitHub/GitLab = cloud backup
Core Git Concepts
Repository (Repo)
Your project folder tracked by Git
Commit
A change record — like a snapshot
Branch
An independent development line branched from main code
Merge
Combining different branches
Remote
Cloud repositories like GitHub, GitLab
Essential Git Commands
# Initialize new repo
git init
# Add files to staging
git add .
# Save changes
git commit -m "Meaningful commit message"
# Add remote server
git remote add origin https://github.com/user/repo.git
# Push code to remote
git push origin main
# Pull code from remote
git pull origin main
# Create new branch
git checkout -b feature/new-feature
# Switch between branches
git checkout main
# Merge branch
git merge feature/new-feature
# Check status
git status
# View history
git log --oneline
Git Branch Strategies
Git Flow
- main — Production code
- develop — Development code
- feature/ — New features
- hotfix/ — Urgent fixes
- release/ — Release preparation
GitHub Flow (Simple)
- main — Always deployable
- feature branches — Separate branch per feature
- Pull Request — Merge after review
How to Write Good Commit Messages
Bad:
- "fix" ❌
- "update" ❌
- "asdasd" ❌
Good:
- "feat: add email validation to user registration form" ✅
- "fix: resolve 500 error on payment page" ✅
- "docs: update API documentation" ✅
Conventional Commits:
- feat: — New feature
- fix: — Bug fix
- docs: — Documentation
- style: — Code formatting (no functional change)
- refactor: — Restructuring
- test: — Adding/fixing tests
- chore: — Maintenance tasks
GitHub vs GitLab vs Bitbucket
| Feature | GitHub | GitLab | Bitbucket | |---------|--------|--------|-----------| | Free repos | Unlimited | Unlimited | Up to 5 users | | CI/CD | GitHub Actions | GitLab CI | Pipelines | | Wiki | Yes | Yes | Yes | | Community | Largest | Large | Medium | | Self-host | Enterprise | Free | Data Center |
Conclusion
Git is the cornerstone of modern software development. From solo projects to large teams, from a single file to projects with thousands of files — professional software development without Git is nearly impossible.
If you'd like to learn Git and modern development practices, reach out for private tutoring: info@cagribilgehan.com. Check out my projects: cagribilgehan.com