Git Version Control

Master Collaboration & Code Management

Why Git?

Distributed

Every developer has full history

Fast

Local operations, instant commits

Branching

Lightweight, easy to merge

Collaboration

Pull requests, code reviews

Essential Git Commands

git init - Initialize repository

git clone <url> - Clone repository

git add . - Stage changes

git commit -m "message" - Commit changes

git push origin main - Push to remote

Branching Strategies

GitFlow

Main, develop, feature, release, hotfix branches

Trunk-Based

Single main branch, short-lived feature branches

Handling Merge Conflicts

<<<<<<< HEAD
Your changes
=======
Their changes
>>>>>>> branch-name

# Steps to resolve:
1. Edit conflicted files
2. Remove conflict markers
3. git add <file>
4. git commit

Pull Requests Best Practices

  • ✓ Keep PRs small and focused
  • ✓ Write clear descriptions
  • ✓ Request specific reviewers
  • ✓ Respond to feedback promptly

Key Takeaways

  • ✓ Git is essential for modern development
  • ✓ Master branching and merging
  • ✓ Use pull requests for collaboration
  • ✓ Choose the right workflow for your team
1 / 7