Git & GitHub

Version Control & Collaboration Workflows

📦 Repo Setup

CommandPurpose
git initInitialize a new local repository
git clone [URL]Clone remote repository
git remote add origin [URL]Link local repo to remote
git config --global user.name "Your Name"Set global username
git config --global user.email "you@example.com"Set global email

📝 Commit Workflow

CommandPurpose
git statusCheck current repo state
git add [file]Stage file for commit
git commit -m "message"Commit staged changes
git logView commit history
git diffShow changes not yet staged

🌿 Branching & Merging

CommandPurpose
git branchList branches
git branch [name]Create new branch
git checkout [name]Switch to branch
git merge [name]Merge branch into current
git branch -d [name]Delete branch

🚀 Push & Pull

CommandPurpose
git push origin [branch]Push commits to remote
git pull origin [branch]Fetch and merge from remote
git fetchDownload changes without merging
git rebase [branch]Reapply commits on top of another branch