Unlike simple file backups, Git is a distributed version control system. When you edit code, changes exist in your Working Directory. Using 'git add' stages changes into the Index. Running 'git commit' captures a permanent cryptographic snapshot (SHA-1/SHA-256 hash) into the repository database.
Entity state & role in architecture: Working Directory (Unstaged files)
# 1. Initialize a brand-new Git repository
$ git init my-awesome-app
$ cd my-awesome-app
# 2. Check current status
$ git status
# On branch main: No commits yet
# 3. Stage changes and commit snapshot
$ echo "console.log('Hello World');" > index.js
$ git add index.js
$ git commit -m "feat: initialize project entry point"
# 4. View concise commit history log
$ git log --oneline
# 7f3a9b1 feat: initialize project entry pointgit initCreates a hidden .git metadata folder containing object storage.
git add index.jsMoves modified file into the staging area preparing for snapshot.
git commit -m "..."Records snapshot permanently with an explanatory commit message.