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 3 of 19

3. Core Daily Workflow

# Check what's changed
git status                   # overview
git diff                     # unstaged changes (working dir vs staging)
git diff --staged            # staged changes (staging vs last commit)

# Stage changes
git add file.txt             # stage one file
git add src/                 # stage a folder
git add -p                   # interactive: stage hunks (partial file staging)
git add .                    # stage everything (use carefully)

# Commit
git commit -m "feat: add login endpoint"
git commit                   # opens editor for multi-line message
git commit --amend           # rewrite the LAST commit (message + content)
git commit --amend --no-edit # amend content, keep message

# View history
git log                      # full log
git log --oneline --graph --all   # compact visual graph
git log -p                   # log + diffs
git log --author="Alice"     # filter by author
git log --since="2 weeks ago"
git log -- path/to/file      # history of one file

# Show a commit
git show <commit-hash>
git show HEAD~2              # 2 commits before HEAD

Good commit messages (Conventional Commits)

<type>(<scope>): <short summary>

[optional body]

[optional footer: BREAKING CHANGE, Closes #123]

Types: feat fix docs style refactor test chore

feat(auth): add JWT refresh token support
fix(cart): prevent duplicate item on re-add
docs: update API setup instructions