What is Git?
Git is the world's most widely used distributed version control system, enabling developers to track changes, collaborate on code, and manage project history efficiently.
- 1.How Git Works
- 2.Core Git Concepts
- 3.Git Workflows
- 4.Git and Autonomous Code Governance
- 5.Frequently Asked Questions
Git is a free, open-source distributed version control system created by Linus Torvalds in 2005 to manage the Linux kernel source code. Today, Git is the de facto standard for version control in software development, used by virtually every professional development team and hosting billions of commits across millions of projects.
How Git Works
Unlike centralized systems, every Git repository is a complete copy of the entire project history. Developers commit changes locally, creating snapshots of the file system state. These local commits are then synchronized with remote repositories hosted on platforms like GitHub, GitLab, or Bitbucket.
Core Git Concepts
The Three States
Files in Git exist in one of three states: modified (changed but not staged), staged (marked for inclusion in the next commit), and committed (stored in the local repository). The staging area gives developers fine-grained control over what goes into each commit.
Branching Model
Git's branching model is its killer feature. Branches are lightweight — just a pointer to a commit. Creating, switching, and merging branches is fast and cheap, enabling developers to maintain isolated lines of work without the overhead of SVN-style branching.
The DAG
Git history is a directed acyclic graph (DAG) of commit objects. Each commit points to its parent commit(s). Merge commits have two parents. This structure makes it possible to reconstruct any state in the history and understand exactly how code evolved.
- git init — initialize a new repository
- git clone — copy a remote repository locally
- git add — stage changes for the next commit
- git commit — record staged changes in history
- git push — synchronize local commits to a remote
- git pull — fetch and merge remote changes
- git branch — create or list branches
- git merge — combine branch histories
- git rebase — rewrite commit history by replaying commits onto a new base
- git log — show commit history
Git Workflows
| Workflow | Branch Strategy | Best For |
|---|---|---|
| Trunk-based | All work on main; short-lived branches | High-velocity teams with strong CI |
| GitHub Flow | Feature branches + PR to main | Web services with continuous delivery |
| GitFlow | Feature, develop, release, hotfix branches | Products with scheduled releases |
| Forking | Personal fork + PR to upstream | Open-source contributions |
Git and Autonomous Code Governance
Hydra uses Git as the medium for all automated governance actions. When Hydra detects a vulnerability, outdated dependency, or policy violation, it creates a branch, commits the fix, and opens a pull request — the same workflow a human developer would follow. Every automated change is traceable, reviewable, and auditable through the standard Git workflow that teams already use.
Frequently Asked Questions
What is the difference between git merge and git rebase?
Both integrate changes from one branch into another. Merge creates a merge commit that preserves the exact history of both branches. Rebase replays commits from one branch on top of another, producing a linear history. Rebase rewrites commits and should not be used on shared branches.
What is a pull request?
A pull request (PR) is a request to merge changes from one branch into another, hosted on a platform like GitHub. It provides a space for code review, automated checks, and discussion before the merge is approved.
What is git bisect?
Git bisect performs a binary search through commit history to find the specific commit that introduced a bug. It is one of Git's most powerful debugging tools.
What is a detached HEAD?
A detached HEAD means the current checkout is a specific commit rather than a branch. Commits made in this state are not on any branch and may be garbage collected. To save work, create a new branch from the detached HEAD state.
Frequently Asked Questions
What is the difference between git merge and git rebase?
Merge preserves full history with a merge commit. Rebase replays commits for a linear history but rewrites commit hashes.
What is a pull request?
A hosted request to merge one branch into another, providing a structured space for code review and automated checks.
What are the three Git states?
Modified (changed), staged (queued for next commit), and committed (saved in local history).
What is git bisect?
A binary search through commit history to find the specific commit that introduced a bug.
Stop flagging. Start fixing.
Hyrax reviews your pull requests, remediates issues autonomously, and closes the ticket.
Join the waitlist