Skip to main content
ValyouValyou.

Git

A version control system that tracks changes in code, enabling collaboration and maintaining a history of all modifications.

Git is a distributed version control system that tracks changes in source code during software development. It enables multiple developers to work on the same codebase without overwriting each other's work.

Why Git Matters

Without version control:

  • You'd have folders named "final," "final_v2," "final_ACTUALLY_final"
  • Collaboration would be chaos
  • Reverting mistakes would mean restoring backups
  • You couldn't see who changed what or why

Core Concepts

Repository (Repo)

A project folder tracked by Git. Contains your code and its entire history.

Commit

A snapshot of your code at a point in time. Each commit has a message describing the changes.

Branch

A parallel version of your code. Work on features without affecting the main codebase:

main ────●────●────●────●
                  \
feature-x          ●────●

Merge

Combine changes from one branch into another. Git automatically handles most conflicts.

Pull Request (PR)

A request to merge your branch into the main branch. Enables code review before changes go live.

Common Git Workflow

  1. Pull latest changes from the remote repository
  2. Create a branch for your feature
  3. Make changes and commit them
  4. Push your branch to the remote
  5. Open a pull request for review
  6. Merge after approval

Git Hosting Platforms

  • GitHub: Most popular, owned by Microsoft
  • GitLab: Self-hostable, built-in CI/CD
  • Bitbucket: Integrates with Atlassian tools

Git vs. GitHub

Git is the tool. GitHub (and GitLab, Bitbucket) are platforms that host Git repositories and add collaboration features like pull requests, issues, and project management.