Git
| Technology | |
|---|---|
![]() Image placeholderPlace the file shown below in the assets/articles folder git.webp | |
| Original author | Linus Torvalds |
| First release | 2005 |
| Written in | C |
| License | GPL-2.0 |
| Website | git-scm.com |
Git is a distributed version control system. Every clone contains the complete history of the repository, so most operations run locally.
History
Linus Torvalds began Git in April 2005 after the Linux kernel community lost free access to the BitKeeper tool. Junio Hamano has been the maintainer since July 2005.
Architecture
Git is a content-addressable store. Objects (blobs, trees, commits and tags) are named by a cryptographic hash of their content. A commit points to a tree snapshot and to its parent commits, forming a directed acyclic graph. Branches are movable references to commits.
$ git init
$ git add README.md
$ git commit -m "Initial commit"
$ git branch feature && git switch feature
$ git merge mainKey mechanisms
Core operations include commit, branch, merge and rebase. Staging allows precise control over what goes into a commit. Remote repositories are synchronised with fetch, pull and push.
Adoption
Git is the dominant version control system for open-source and commercial software. Hosting services such as GitHub and GitLab add pull requests and code review on top of it. It was designed originally for the Linux kernel.
Ecosystem
Git handles large binary files poorly without extensions such as Git LFS, and its command-line interface is considered inconsistent by many users.
Snapshots and object storage
Git stores repository history as objects. A blob represents file content, a tree represents a directory and its file names, and a commit records a project snapshot together with metadata and parent commits. Tags provide human-readable references to particular points in history. Objects are addressed by a hash of their content, which allows Git to detect changes and avoid storing identical content repeatedly. Modern Git repositories may use different hash algorithms, but the underlying content-addressable model remains central.
A branch is a movable reference to a commit rather than a separate copy of the project. Creating a branch is therefore inexpensive. A developer can experiment on a topic branch and later merge the work into another branch. Because a commit records its parents, the history forms a directed acyclic graph. This graph can represent both linear development and parallel lines of work.
The working tree and staging area
Git distinguishes the working tree, the index (often called the staging area) and the committed repository. The working tree contains the files being edited. The index records the content planned for the next commit. This extra step lets a developer commit only selected changes from a larger working-tree edit. It supports focused commits and makes it easier to separate unrelated work.
Commands such as git status, git diff and git log help inspect the state of a repository. git diff can compare the working tree with the index or compare commits. git restore and git reset operate on different parts of the local state, so they should be used with an understanding of which changes they modify. A commit is not automatically uploaded to a server; it remains local until it is pushed to a remote repository.
Merging, rebasing and collaboration
When two branches change different parts of a project, Git can often combine them automatically. A merge commit records the integration of two histories. Rebasing instead replays commits onto a different base, creating a more linear sequence of commits. Both approaches can be useful; teams choose based on review practices, release workflows and preferences about preserving branch topology. Rewriting commits that other people already depend on can cause unnecessary coordination problems.
Remote repositories allow people to exchange commits. fetch downloads information without automatically changing the current branch, while push publishes local commits. pull combines fetching with an integration step, commonly a merge or rebase depending on configuration. Hosting platforms add code review, issue tracking, access controls and automation, but the core version-control model remains available from the command line.
Strengths and limitations
Git is distributed, so most history inspection and branch operations work without a network connection. Local commits provide checkpoints, and clones act as full backups of repository history. These properties make Git resilient and useful for both small projects and large open-source communities.
The model also has a learning curve. Developers must distinguish the working tree, index, commits and remote-tracking references. Merge conflicts require judgement rather than a universal automatic solution. Large binary files are inefficient because each changed version can add substantial data; Git LFS and specialised artifact stores address some of these cases. Generated files and dependency directories can make repositories difficult to review when they are committed unnecessarily.
A tool for preserving project history
Git's long-term value comes from making change inspectable. A useful history explains not only what files look like now but why they changed, who reviewed the change and how it relates to other work. Small, clear commits, meaningful messages, automated tests and a consistent review process make the data Git stores more valuable to future maintainers.
Editorial connections and engineering implications
The object database and collaborative history
Git stores repository content as objects identified by cryptographic hashes. Blobs represent file contents, trees represent directory structure and commits connect a tree to its parent history. Branches are lightweight references to commits, which makes local branching inexpensive and lets most operations work offline. A commit represents a snapshot relationship rather than merely a patch; tools derive differences by comparing trees.
Merging combines histories, while rebasing creates new commits on a different base. Because rebase changes commit identities, rewriting shared history can disrupt collaborators who have based work on earlier commits. A repository can also preserve credentials or sensitive data in old commits even after they are removed from the latest version. Removing the file is not enough: exposed credentials should be rotated. Git supplies version control; platforms such as GitHub add review, issue tracking, permissions and automation. Small commits and clear messages turn the history into a useful engineering record.
See also
- Linux – A family of open-source, Unix-like operating systems based on the Linux kernel.
- GitHub – A web platform for hosting Git repositories and collaborating on software with pull requests, issues, automation and apps.
- Linus Torvalds – Finnish-American software engineer who created the Linux kernel and the Git version control system.
- Kubernetes – An open-source system for automating deployment, scaling and management of containerised applications.
- PostgreSQL – An open-source object-relational database system with a strong emphasis on standards compliance and extensibility.
- Docker – A platform for building, distributing and running applications in containers.
- Microsoft – An American technology company known for Windows, Office, Azure and developer tools.
- C (programming language) – A general-purpose, statically typed systems programming language created at Bell Labs in the early 1970s.
References
- ↑ Pro Git (book) (git-scm.com)
