Initializing and Inspecting Repositories

Use git init when starting version control in an existing directory. Use git clone when obtaining an existing repository. The git status command is one of the most frequently used Git commands because it explains the current state of tracked, modified, staged, and untracked files.

Use git status Frequently

Running git status before staging, committing, switching branches, or cleaning files prevents many common Git mistakes.

Repository Inspection
git init
git status
git log --oneline
git branch
git remote -v
💡 These commands help establish whether the directory is a repository, what changes exist, what commits are present, which branches exist, and which remote repositories are configured.
Key Takeaways
  • git init creates a repository while git clone copies an existing repository.
  • git status is the primary command for understanding your current working state.
Knowledge Check

Which command creates a new Git repository in the current directory?