DevOps
You Installed Git. Here Are the Next Ten Minutes.
James Joyner DEV Community
1 views
"Install Git on Windows" is the query that brings more people to my site than any other. The install pages get the traffic, and then everyone leaves — because installing Git is not the hard part. Knowing what to type in the next ten minutes is.
So here are the next ten minutes. Three steps, every command run (git 2.43.0), real output. Works the same in Git Bash on Windows, Terminal on macOS, and any Linux shell.
Minute 1–3: tell Git who you are
Every commit permanently records an author. Git will not guess it, and it will refuse to commit until it is set:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main
git config --global --list
user.name=Your Name
user.email=you@example.com
init.defaultbranch=main
--global writes to your user-level config, so it applies to every repository you create on this machine. The third line makes new repositories start on a branch called main instead of the older default, which saves a warning later.
(If you ever want to know which file a setting came from: git config --list --show-scope --show-origin. Three scopes — system, global, local — and the most specific wins.)
Minute 4–7: make a repository and a first commit
A folder, one file, one snapshot:
mkdir hello && cd hello
git init
echo "# Hello" > README.md
git add README.md
git commit -m "First commit"
Initialized empty Git repository in …/hello/.git/
[main (root-commit) 89ee335] First commit
1 file changed, 1 insertion(+)
create mode 100644 README.md
Then look at what you made:
git log --oneline
git status
89ee335 First commit
On branch main
nothing to commit, working tree clean
Three things worth noticing already:
89ee335 is a hash of the snapshot. Yours will be different, because it includes your name and the time. That id is how Git refers to this exact state forever.
git add then git commit is two steps on purpose. add chooses what goes into the next snapshot (the index, or staging area); commit takes the snapshot. You will use that gap constantly later — committing half of your changes, for instance.
Everything happened on your disk. No account, no server, no network. GitHub is a place to put repositories; Git is the tool, and it works entirely offline.
Minute 8–10: learn what you just did
The commands above are the what. The reason people struggle with Git for years is that they never get the why: a commit is a snapshot, not a diff; a branch is a pointer, not a folder; there are three places a change can live, and git status is telling you which one.
That model is a week of short lessons, not a semester. I sequenced it as a 7-Day Git Challenge — one lesson a day, a lab on the days where doing beats reading:
Day
What you will be able to explain
1
Why a commit is a snapshot, and why every clone is complete
2
Working tree, index, repository — and how to read git status --short
3
What git add actually writes, and why partial staging is possible
4
HEAD → branch → commit, and what "detached" means (lab: recover a lost commit)
5
Branches are pointers; nothing is copied (lab: recover a deleted branch)
6
restore vs reset vs revert — by where the change is (lab)
7
Read conflict markers as punctuation and resolve a merge properly (lab)
Start here: 7-Day Git Challenge. Progress is tracked in your browser — no account, nothing to sign up for. Day 1 is What is Git? if you would rather skip the tracking and just read.
And if the install itself is what brought you here, the platform-specific pages cover the parts that actually go wrong — PATH not updating in an already-open terminal, core.autocrlf, Credential Manager, WSL having its own separate Git: Windows, macOS, Ubuntu.
Read original: https://dev.to/jjoyneriv/you-installed-git-here-are-the-next-ten-minutes-4gpi
← Previous
Someone Force-Pushed Over main. Here Is the Reflog Nobody Knows They Have.
Next →
Your Fine-Grained GitHub Token Gets 404, Not 403. Check These Four Things Before the URL.
Related
Someone Force-Pushed Over main. Here Is the Reflog Nobody Knows They Have.
DevOps
0
DEV Community
Your First AWS Production Architecture: From a Simple Application to a Scalable System
DevOps
0
DEV Community
Syncing your Obsidian
DevOps
5
DEV Community
Mastering Advanced Server-Side Caching Patterns in Next.js 14
DevOps
5
Dev.to (EN Zone)
Comments0
No comments yet — be the first