Git Fundamentals
Git is a distributed version control system that tracks changes to source code across branches, enabling multiple developers to work concurrently and merge their history. It stores snapshots of a project's files, provides cheap branching, and operates fully offline.
itDevOps and software delivery | OpenSkills.info
Intro
Git Fundamentals
Git is a distributed version control system: each ordinary clone contains the project files, the repository's reachable history, and references such as branches and tags. Most inspection and history operations are therefore local. A hosting service can coordinate collaboration, but it is not Git itself and it is not the only copy of the repository.
The useful beginner model is not “Git saves files.” Git records snapshots and relationships. A commit identifies a project tree, its parent commit or commits, author and committer information, and a message. Commits and file contents are immutable objects; names such as main, feature/login, and v1.0.0 are references that make selected objects convenient to find.
The four places you reason about
Day-to-day Git becomes predictable when you distinguish four places:
- Working tree — the files you are editing.
- Index, usually called the staging area — the exact file contents proposed for the next commit.
- Current commit (
HEAD) — the snapshot currently checked out through a branch, or directly in detached-HEAD state. - Remote-tracking references — local records such as
origin/maindescribing the last state fetched from a remote.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://git-scm.com/docs/gitdatamodel
Supports
- Objects, references, index, and reflogs as the core data model
- Commit, tree, blob, branch, HEAD, and remote-tracking-reference semantics
- Commits point to trees and parent commits; displayed diffs are calculated
- Reflogs are local, can aid recovery, and do not retain entries forever
- https://git-scm.com/book/en/v2/Getting-Started-What-is-Git
Supports
- Snapshot-oriented model and local operation
- Tracked, modified, and staged states
- Integrity and recoverability framing
- https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository
Supports
- Working-tree, staging, diff, and commit loop
- Tracked and untracked file states
- https://git-scm.com/docs/giteveryday
Supports
- Representative everyday status, diff, add, commit, switch, merge, and log usage
- https://git-scm.com/docs/git-switch
Supports
- Branch creation and switching semantics
- Index and working-tree updates and protection against loss of local changes
- https://git-scm.com/docs/git-merge
Supports
- Merge, fast-forward, conflict, continuation, and abort behavior
- https://git-scm.com/docs/git-rebase
Supports
- Reapplication of commits on a new base and replacement commit identities
- https://git-scm.com/docs/git-fetch
Supports
- Object download and remote-tracking reference updates without current-branch integration
- https://git-scm.com/docs/git-pull
Supports
- Pull as fetch followed by integration using merge or rebase
- https://git-scm.com/docs/git-push
Supports
- Remote reference update semantics, rejection, force, and force-with-lease behavior
- https://git-scm.com/docs/git-restore
Supports
- Working-tree restoration and index restoration with --staged
- Destructive consequences of intentionally discarding local content
- https://git-scm.com/docs/git-reset
Supports
- Soft, mixed, and hard reset effects on branch, index, and working tree
- https://git-scm.com/docs/git-revert
Supports
- Recording a new commit that reverses an earlier commit
- https://git-scm.com/docs/git-reflog
Supports
- Viewing and managing local reference logs for inspection and recovery
