All guides
Term

Git

A distributed version control system for tracking changes in source code and coordinating work among multiple developers.

Git is a distributed version control system (DVCS) created by Linus Torvalds for tracking changes in source code and coordinating work among multiple developers. Unlike centralized systems, every Git working directory is a full-fledged repository containing a complete history of changes, allowing engineers to commit, branch, and inspect history offline without a constant connection to a remote server.

How it works

Git stores project data as a stream of snapshots rather than line-by-line file diffs. When you run git commit, the system captures the exact state of all tracked files at that moment and references unchanged files via pointers to save space. Branches are lightweight movable pointers to specific commits, making branch creation and context switching nearly instantaneous.

  • Staging Area: An intermediate index where modified files are prepared and reviewed before becoming part of the permanent commit history.
  • Cryptographic Hashing: Every commit, tree, and file blob in the Git database is identified by a unique SHA-1 (or SHA-256) checksum, guaranteeing data integrity and preventing silent corruption.
  • Merge and Rebase: Core strategies for integrating parallel lines of work, either by preserving branch history with a merge commit or by replaying commits onto a new base.

Example

A typical feature workflow involves creating an isolated branch, staging changes, committing a snapshot, and pushing the branch to a remote repository for code review:

git checkout -b fix/auth-timeout
git add src/auth/session.js
git commit -m "Increase session token refresh window"
git push -u origin fix/auth-timeout

Once reviewed, the branch can be merged into main or deployed directly via a webhook-triggered CI/CD pipeline.

What matters when choosing a server or hosting

While Git itself runs locally, teams rely on remote Git servers for collaboration, access control, and automated testing. When self-hosting a Git platform on a virtual private server, resource requirements depend heavily on the software stack rather than Git alone.

Lightweight Go-based platforms run comfortably on modest hardware with minimal memory overhead, whereas full DevOps suites with built-in container registries and CI runners require substantial RAM and fast NVMe storage for concurrent operations. You can compare exact resource footprints in our Gitea vs GitLab: Performance Data and Hosting Costs breakdown, or inspect hardware sizing in our Self Host GitLab on VPS: Performance and Cost Guide. Teams seeking a community-governed lightweight option can also review our Forgejo Review: Our Self-Hosted Git Performance & Cost Data. Key infrastructure priorities include automated off-site backups, SSH key enforcement, and low-latency network throughput for large repository clones.

Common mistakes

  • Committing secrets and credentials: Pushing API keys or environment files exposes them permanently in the repository history, even if deleted in a subsequent commit.
  • Tracking large binary assets directly: Storing compiled binaries, videos, or massive datasets bloats repository size and slows down every clone; use Git LFS instead.
  • Force-pushing to shared branches: Running git push --force on main rewrites public history and causes severe synchronization conflicts for teammates.

FAQ

What is the difference between Git and GitHub?

Git is the open-source command-line version control tool installed on your machine, while GitHub is a cloud-based hosting service that stores Git repositories and adds pull requests, issue tracking, and CI/CD workflows.

When should I use git rebase instead of git merge?

Use git rebase to keep a clean, linear commit history on local feature branches before sharing them, and use git merge when integrating completed branches into shared branches like main.

Can Git handle repositories with large files?

Standard Git struggles with large binary files because every clone downloads every historical version. Extending Git with Git Large File Storage (LFS) replaces heavy files with lightweight text pointers while storing the actual assets on a separate server.

All glossary terms

Glossary

Related terms

Full glossary

New guides every week.

A digest of the best pieces on servers, VPN and self-hosted software. No ads, no spam.

1 email a weekOne-click unsubscribeRU · EN
Only slipjar.app articles, nothing else.