Git init & local configuration
This course covers starting and configuring a Git repository on your own machine. It explains why version control replaces folders of renamed files, what git init creates inside the hidden .git folder, and how to set a default branch name. You set your author identity and useful defaults with git config across system, global and local scopes. You also write .gitignore patterns, inspect a repository with status, log and diff, separate work and personal identities with includeIf, and bootstrap the Git history of a new Rails project.
What you'll learn
- ✓What git init creates and how the .git folder is organized
- ✓Setting author identity, defaults and aliases with git config
- ✓Writing .gitignore patterns and keeping secrets out of history
- ✓Inspecting changes and history with git status, git log and git diff
- ✓Switching identities per folder with includeIf
- ✓Starting a Rails project's Git history with a first commit
Why every project needs version control
Picture a project folder like this:
Read the full lesson free →Curriculum
7 lessonsWhy every project needs version control
Why version control replaces folders of renamed files, how commits form a timeline, and the core Git terms.
git init: anatomy of a repository
What git init creates in the .git folder, the three file states, and setting the default branch.
git config: your identity and defaults
Setting author name and email, the system, global and local config scopes, useful defaults and aliases.
.gitignore: what Git should never see
Writing .gitignore patterns, keeping .env files out of history, untracking committed files and setting a global ignore file.
Inspecting a repository: status, log, and diff
Using git status, git log and git diff, plus git show and per-file history, to inspect a repository.
Multiple identities: per-project config
Keeping separate work and personal identities with local config or automatic includeIf rules based on folder location.
Putting it all together: bootstrapping a Rails project's Git history
Checking what rails new sets up, confirming identity, making the first commit and running a health check.