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
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 software delivery lifecycle✓ Learned
The everyday loop
- Edit files
- git add
- git commit
- 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
- Download Git ↗ Installers for Windows and macOS, packages for Linux.
Official documentation and references
Documentation
- Git documentation ↗ Official · Git project
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
- Branches and pull requests ›✓ Learned
Related topics
- Branches and pull requests✓ Learned
- Configuration and secrets✓ Learned
Done with this topic?
Reviewed 2026-10-23. Links go to the official documentation unless marked otherwise.