Roadmap › Git & GitHub — Version Control from Basics to Advanced › Module: Git Basics
Lessons in this course (10)
1. Setup, init, clone and the three areas
Basic★ Must knowLesson 1 of 10
bash
git config --global user.name "Divakar Upadhyay"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main
git init # new repo in the current folder
git clone https://github.com/org/repo.git # copy an existing repo (all history)The three areas:
text
Working tree --git add--> Staging area (index) --git commit--> Repository (.git)
(your files) (what goes in the next commit) (history)bash
git status # what changed, what is staged
git add Program.cs # stage one file
git add -p # stage chosen hunks interactively (great for clean commits)
git commit -m "Validate order quantity"
git log --oneline --graph --decorate --all
git diff # working tree vs staged
git diff --staged # staged vs last commit.gitignore — never commit build output, secrets or local settings:
text
bin/
obj/
node_modules/
*.user
.vs/
appsettings.Development.json
.envInterview tip: A good commit message: short imperative summary (≤ 50 chars), blank line, then why. "Fix null reference when customer has no address".