Git & GitHub Documentation
Comprehensive guide to mastering Git and GitHub - from basics to advanced techniques
Documentation
Choose a section to learn
What is Git?
Learn the basics of Git and GitHub
Git is a distributed version control system (DVCS) used to track changes in files and coordinate work between multiple people.
What Git does:
-
Keeps a complete history of every change made to your files Allows you to go back to previous versions at any time
Lets multiple developers work together without overwriting each other's work makes branching easy so you can experiment without breaking the main code
Why developers use Git:
- • Collaboration: Teams can work on the same codebase efficiently
- • Backup: Your history is stored locally and can also be pushed to remote servers like GitHub
- • Experimentation: Try new features safely in branches
- • Version tracking: See exactly who changed what and when
Common Commands
git --version
Check installed Git version
git help
Get help with Git commands
git init
Initialize a new Git repository in the current folder
git status
Check which files are changed and ready to commit
git add <file>
Stage specific file(s) for commit
git add .
Stage all changes for commit
git commit -m "message"
Save staged changes with a message
git log
View commit history
git branch
List all branches
git checkout -b <branch-name>
Create and switch to a new branch
git merge <branch-name>
Merge changes from another branch into the current branch
git remote add origin <repo-url>
Connect local repo to remote repository
git push origin main
Push changes to the main branch on remote
git pull
Fetch and merge changes from remote repository
Quick Start Guide
Essential Git commands to get you started immediately
First Time Setup
git config --global user.name Your Name
git config --global user.email you@example.com
Daily Workflow
git add .
git commit -m message
git push origin main