What is Git?
•Git is a Distributed Version Control System
(DVCS)
• Tracks changes in code/projects over time
• Enables multiple people to work together
• Think of it as 'Google Docs for Code'
3.
What is GitHub?
•GitHub is a web-based platform for hosting Git
repositories
• Enables collaboration through code sharing,
pull requests, and more
• Helps manage projects and contributions
efficiently
4.
Why Use Gitand GitHub?
• Track versions of your work
• Collaborate with others easily
• Rollback to previous versions
• Showcase projects in portfolio
• Contribute to Open Source
5.
Basic Git Terminology
•Repository (Repo): A project tracked by Git
• Commit: A snapshot of changes
• Branch: A separate line of development
• Merge: Combine changes from different
branches
• Push/Pull: Upload/download changes to/from
GitHub
6.
GitHub Workflow (Simple)
•Create Repository
• Clone to local machine
• Make changes and commit
• Push changes to GitHub
• Open Pull Request
• Merge changes
7.
Getting Started –Setup
• Install Git on your computer
• Create a GitHub account
• Setup SSH key or HTTPS access
• Configure Git with your name and email
8.
Basic Git Commands
•git init – Initialize a repository
• git clone – Copy repo from GitHub
• git status – Check current state
• git add . – Stage changes
• git commit -m "message" – Save snapshot
• git push – Upload to GitHub
• git pull – Download updates
9.
Branching and Merging
•Create a new feature branch: git branch
feature-x
• Switch to the new branch: git checkout
feature-x
• Merge back to main: git checkout main -> git
merge feature-x
10.
Collaboration using GitHub
•Fork a repository
• Create Pull Requests
• Review & Merge code
• Resolve merge conflicts
11.
Real-Life Use Cases
•Team Projects
• Portfolio Building
• Open Source Contribution
• Project Management (Issues & Projects tab)
12.
Best Practices
• Writemeaningful commit messages
• Pull before you push
• Use .gitignore to exclude unwanted files
• Keep branches clean and updated