Git basics

Beginner 12 min read

Record changes as commits, see what changed and share your work through a remote repository.

Why it matters

Git is how teams keep a history of every change, work in parallel and undo mistakes. CI/CD, code review and deployment all start from a Git repository.

Where it fits

  1. Plan & Design
  2. Develop
  3. ● Version control
  4. Verify
  5. Build & Package
  6. CI/CD
  7. Deploy
  8. Operate

What you will learn

  • Install Git and set your name and email.
  • Create commits and read the history.
  • Push to and pull from a remote repository.

Before you start

The everyday loop

  1. Edit files
  2. git add
  3. git commit
  4. git push
Example
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

git clone https://example.com/team/app.git
cd app
git status            # what changed?
git add src/login.js  # stage a file
git commit -m "Fix login redirect"
git push              # share it
git log --oneline     # the history

Good commits

  • One logical change per commit, so it can be reviewed and reverted on its own.
  • A message that says what changed and why, in the imperative: "Fix login redirect".
  • Commit generated files and secrets never; list them in .gitignore.

Watch out: A secret that was ever committed stays in the history even after you delete the file. Treat it as leaked: revoke it and create a new one.

Install and set up

Official documentation and references

Documentation

Guides

  • Pro Git (book) ↗ Official · Git project — Free, complete and readable from chapter one.

Specifications

  • Conventional Commits ↗ Official · conventionalcommits.org — A common format for commit messages; optional, but many teams use it.

Learn next

Done with this topic?

Reviewed 2026-10-23. Links go to the official documentation unless marked otherwise.