Skip to main content
Glossary

Git

A distributed version control system that tracks changes to source code over time, enabling collaboration, branching, and history management.

Detailed Explanation

Git is the most widely used version control system in software development. It tracks every change to your codebase, creating a complete history that can be navigated, compared, and reverted. Git is distributed, meaning every developer has a complete copy of the repository, enabling offline work and fast operations.

Key Git concepts include: commits (snapshots of your code), branches (parallel lines of development), merges (combining branches), remotes (central repositories like GitHub), and staging (preparing changes for commit). Git's branching model enables powerful workflows like feature branches, GitFlow, and trunk-based development.

Why It Matters

Git is the universal standard for code version control. Every developer must know Git, and every team needs a Git workflow.

Real-World Example

A developer creates a feature branch, makes changes, opens a pull request. Team members review the code, suggest changes, and approve. The branch is merged to main, and the CI/CD pipeline deploys it—all managed through Git.

When to Use

For any code project, from solo side projects to enterprise teams. There is no situation where version control is not beneficial.

Advantages

  • Complete history of all changes
  • Powerful branching and merging
  • Distributed: works offline
  • Fast operations (most are local)
  • Integrates with GitHub, GitLab, Bitbucket

Disadvantages

  • Steep learning curve for advanced features
  • Large binary files can bloat repositories
  • Merge conflicts can be complex
  • History rewriting (rebase) can cause data loss
  • Requires discipline to maintain clean history

Frequently Asked Questions

What is the difference between Git and GitHub?

Git is the version control tool that runs locally. GitHub is a cloud platform that hosts Git repositories and adds collaboration features (pull requests, issues, actions). GitLab and Bitbucket are similar to GitHub.

What is a Git workflow?

A Git workflow is a team's agreed-upon process for using Git. Common workflows include trunk-based development (simple, fast), GitFlow (structured, release-oriented), and GitHub Flow (pull request based, simple).

How do I resolve merge conflicts?

Conflicts occur when two branches modify the same lines. Open the conflicted files, choose which changes to keep (or combine them), remove conflict markers, and commit the resolution. Use VS Code's merge editor for visual conflict resolution.

When should I use rebase vs merge?

Use merge to preserve the complete history of branches. Use rebase to create a clean, linear history. Never rebase commits that have been pushed to a shared branch. Rebase for local cleanup; merge for shared history.

How do I undo a Git commit?

Use `git revert <commit>` to create a new commit that undoes changes (safe for shared branches). Use `git reset --soft <commit>` to undo a commit but keep changes (for local corrections). Never reset commits that others depend on.

Back to Glossary

Browse all terms in our software development glossary.

Browse All Terms