← Lessons/Your First Commit
← Your First Commit

Stage the file

Learn

Stage a change: git add

Committing is a two-step move. First you stage a change with git add <file>: you mark it to go into the next snapshot. Staging lets you choose exactly what goes into a commit, even when you've changed several files.

One-time setup first: Git stamps every commit with an author, so it needs to know who you are. Set it per repository with git config:

git config user.email "you@example.com"
git config user.name "You"

After git add, git status lists the file under Changes to be committed.

Set your identity with git config user.email/user.name, then git add README.md to stage it. git status should now show it under Changes to be committed as a new file.

sandbox@opspath: ~
OpsPath sandbox · Debian GNU/Linux 12 · GNU bash 5.2
Your session carries over: files, commits, branches and cd all stick.
Press restart (top right) to go back to this mini lesson's starting point.
Type a command and press Enter. ↑/↓ history · Ctrl+L clear · Ctrl+C cancel line
# ── Step 2 · Stage the file ──
# Sign in to run commands — it's free.