Vasu Patel logoVasu Patel
← Git Mastery
All chapters in this track
  1. 011. The Mental Model
  2. 022. Essential Setup
  3. 033. Core Daily Workflow
  4. 044. Branching
  5. 055. Merging & Conflict Resolution
  6. 066. Rebasing
  7. 077. Remote Repositories
  8. 088. Stashing
  9. 099. Undoing Things
  10. 1010. Tagging & Versioning
  11. 1111. Cherry-Pick
  12. 1212. Git Bisect & Blame
  13. 1313. Git Hooks
  14. 1414. Submodules
  15. 1515. Team Workflows
  16. 1616. Power Commands & Aliases
  17. 1717. Reflog: The Safety Net
  18. 1818. Practice Tasks
  19. 19Quick Reference Cheatsheet

Chapter 2 of 19

2. Essential Setup

First-time configuration

git config --global user.name  "Your Name"
git config --global user.email "you@example.com"
git config --global core.editor "code --wait"   # VS Code as editor
git config --global init.defaultBranch main
git config --global pull.rebase false            # merge strategy on pull (change to true for rebase)

View config

git config --list --show-origin   # all settings + where they come from
git config user.name              # check a single value

Initialize or clone

git init my-project      # new repo
git clone <url>          # copy existing repo
git clone <url> folder   # clone into specific folder

.gitignore essentials

# Compiled output
*.class
*.pyc
__pycache__/
dist/
build/

# Environment & secrets
.env
*.pem
secrets.json

# Editor
.vscode/
.idea/

Generate project-specific ignore files at gitignore.io.