What Is Git? Plain-English Definition, How Commits and Branches Work, and Git vs GitHub in 2026
Git is a distributed version control system that saves full snapshots of your project, so you can branch, compare and undo any change without a server. Every clone holds the entire history. It is free and open source, and 93.87% of developers in Stack Overflow's last survey to ask the question said they use it.
- Git is a snapshot machine, not a diff machine. Each commit records a complete picture of your tracked files, addressed by a hash, which is why creating and switching branches is nearly instant.
- Four places, not two. Work moves from working tree to staging area to local repository to remote, and most confusing Git errors are really a question about which of those four you are standing in.
- Git and GitHub are different products. Git is the program on your laptop; GitHub is one of several places to host the repositories it makes. You can use Git for years without an account anywhere.
- Scale is rarely the limit people assume. Microsoft's Azure DevOps blog reports the Windows repository holds over 100 GB of compressed objects with an index of more than three million entries, and it runs on Git.
-
The default branch name is changing. Git's breaking-changes plan switches the initial branch from master to main in Git 3.0, which is why
git initstill prints a hint about it today. -
Five commands cover most days. status, add, commit, switch, push. Nearly everything else is recovery work, and
git reflogrecovers far more than beginners expect.
You renamed a folder, ran a find and replace across forty files, and now the app will not start. Twenty minutes ago it worked. Your editor's undo history stops three saves short of the version that ran, and nobody else has a copy. That sinking feeling is why Git exists. For illustration I keep returning to one setup: Meera and Arun, a two-person analytics team at a mid-size insurer in Pune who share one Power BI report, one folder of SQL files and no version control at all.
What Is Git and the Problem It Actually Solves
Git answers two questions that get harder every week a project lives: what changed, and how do I get back. The older answers were dated folders (reports_final_v3_arun.sql) or a central server handing out file locks. The folder approach loses the reasoning behind each change; the lock approach means Arun cannot touch the file while Meera has it open.
Git is distributed, which has one consequence worth understanding before any command: cloning a repository gives you the whole history, not a working copy checked out from a server. Meera can commit on a flight with no network, create five branches, read a change Arun made in March, and push the lot next morning. Subversion, which Git displaced in most shops, could not do that because the history lived on the server.
Stack Overflow's 2022 developer survey, the last one to ask about version control, found Git at 93.87%, or 67,006 of 71,379 responses. The same survey found 17% of people learning to code use no version control at all, which describes where Meera and Arun start. Any DevOps engineer role assumes Git on day one, as does every certification in the full certifications overview.
What Is a Git Repository
A Git repository is an ordinary folder plus a hidden .git directory that holds the entire history. Nothing else is special about it. Run this and look:
$ mkdir claims-report && cd claims-report
$ git init
Initialized empty Git repository in /home/meera/claims-report/.git/
$ ls .git
HEAD config description hooks info objects refs
Two of those matter. objects stores your content, compressed and named by its SHA hash, so identical content is stored once however many commits reference it. refs stores branch and tag names, which are just files containing a commit hash. A branch in Git is a 41-byte file. That is why branching feels free here and felt expensive in older tools.
How Does Git Work? The Four Places Your Code Lives
Almost every beginner Git question is really a question about location. There are four places a version of a file can sit, and the commands are named after the moves between them.
The four places, and the command that moves between each
Read it top to bottom for the everyday loop, and right to left for the undo path
Command behaviour checked against Git 2.56.1, the current release listed on git-scm.com, on 14 November 2026.
The staging area is the part people skip, and the part that makes Git worth learning. It separates what goes into a commit from what you happen to have edited. Meera can fix a typo and rewrite a query in one sitting, then commit them separately, so six months later the commit that broke the dashboard is findable. Tools without one force you to commit your whole working state, which is how you get a history of commits called "updates".
| Command | What it moves | From | To |
|---|---|---|---|
git add count.sql |
The current content of that file | Working tree | Staging area |
git commit -m "msg" |
Everything staged, as one snapshot | Staging area | Local repository |
git push |
Commits on your current branch | Local repository | Remote |
git fetch |
New commits and branch refs | Remote | Local repository |
git restore count.sql |
The last committed content of that file | Staging area or HEAD | Working tree |
git reset --soft HEAD~1 |
The branch pointer only, keeping your work staged | Local repository | Staging area |
git stash |
Uncommitted edits, parked out of the way | Working tree and index | A stash entry |
One configuration detail matters on a fresh install. Run git init without setting init.defaultBranch and Git prints a hint that the initial branch name is subject to change. That is not noise: Git's breaking-changes plan switches the default from master to main in Git 3.0, matching what the major hosts already use. Set it yourself and the hint goes away.
Commits, Branches and Merges: A Worked Example You Can Run
Type this into an empty folder. It takes about three minutes and it teaches more than an hour of reading will.
# one time, on any new machine
git config --global user.name "Meera K"
git config --global user.email "meera@example.com"
git config --global init.defaultBranch main
# the loop you will run a thousand times
git init
echo "SELECT count(*) FROM claims;" > count.sql
git add count.sql
git commit -m "Add claim count query"
# branch, change, merge
git switch -c add-region-filter
echo "SELECT count(*) FROM claims WHERE region = 'West';" > count.sql
git commit -am "Filter claims by region"
git switch main
git merge add-region-filter
git log --oneline --graph --all
That last command prints something close to this, with different hashes because the hash covers your name, email and timestamp:
* 9c1f2ab (HEAD -> main, add-region-filter) Filter claims by region
* 4d7e0b1 Add claim count query
Both branch names point at the same commit, because main had not moved and Git simply slid its pointer forward. That is a fast-forward merge, and it is the quiet majority of merges in a small team. No merge commit was created because none was needed.
Now make it fail on purpose, because conflicts are the thing people fear and the thing that is genuinely simple once seen:
git switch -c team-edit
echo "SELECT count(*) FROM claims WHERE region = 'South';" > count.sql
git commit -am "Filter claims by South region"
git switch main
echo "SELECT count(*) FROM claims WHERE region = 'North';" > count.sql
git commit -am "Filter claims by North region"
git merge team-edit
# Auto-merging count.sql
# CONFLICT (content): Merge conflict in count.sql
git diff --name-only --diff-filter=U
# count.sql
# open count.sql, delete the marker lines, keep the version you want, then:
git add count.sql
git commit -m "Merge team-edit, keep the North filter"
A conflict is not an error. It is Git declining to guess which of two edits to the same lines you meant, and handing you both. The markers (<<<<<<<, =======, >>>>>>>) are plain text you delete by hand, and git add on the file is how you say you are done.
-
A branch is a pointer, not a copy.
git switch -c anythingcosts nothing and deletes cleanly. The habit that separates people who are comfortable in Git from people who are not is making a throwaway branch before every risky change, every single time.
Also read: Git Commands Cheat Sheet 2026: 40 Commands, Worked Examples and How to Undo Almost Anything for the reference version of everything above.
Git vs GitHub: The Difference That Trips Up Every Beginner
The two words get used as synonyms and they are not close. Git is a program. GitHub is a website and an API that stores repositories made by that program and adds a workflow on top.
| Git | GitHub | |
|---|---|---|
| What it is | Software you install and run locally | A hosted service holding Git repositories |
| Origin | Started by Linus Torvalds in 2005, now a community project | A company, owned by Microsoft since 2018 |
| Works offline | Yes, including commits, branches and history search | No |
| What it adds | Version control and nothing more | Pull requests, code review, issues, Actions, access control |
| Cost | Free, open source under GPLv2 | Free plan, with paid tiers above it |
| Replaceable | Not if you want Git history | Yes: GitLab, Bitbucket, Azure Repos, or a bare repo on your own server |
| What an interviewer means by it | Do you understand commits, branches and merges | Have you worked inside a review workflow |
Two numbers from GitHub's own billing documentation are worth knowing before you plan around the free plan. Included compute for Actions is no longer stated as a minute count; the docs now express it as a monetary allowance, 12 US dollars a month on GitHub Free, against a standard Linux runner rate of 0.006 dollars a minute. Artifact storage on Free is 500 MB, and that allowance is pooled with GitHub Packages rather than being separate. Plenty of guides still quote a flat 2,000 minutes, which comes from the older pricing page.
If your employer runs on Microsoft tooling, the host you meet will more likely be Azure Repos, and the Git underneath is identical; the AZ-400 content inside a live Azure architecture and DevOps program spends its hours on pipelines and policies, not on reteaching commits. The skill transfers completely. The web interface does not.
What Is Git Used For? Three Places You Will Meet It in Real Work
1. Analytics and BI files, not just application code
This is the one that surprises people. A Power BI report saved as a Power BI Project (.pbip) is a folder of plain text files rather than one binary .pbix, and Power BI Desktop generates a .gitignore alongside it that excludes caches and local settings. That makes report changes reviewable line by line for the first time. Going further, Microsoft Fabric connects a workspace directly to a Git branch, with two documented limits that shape how you work: you need a Fabric capacity at F2 SKU or higher, and the combined size of files in one commit is capped at 50 MB. Only Azure DevOps and GitHub are supported providers. Wiring that up is one of the exercises inside 360DT's live Fabric data engineering program, because the DP-700 workload expects you to deploy from source control rather than by hand.
For Meera and Arun this is the whole argument: their report lives on a network drive called Final, and moving it into a repository means Arun can see that Meera changed a measure, and why, without opening the file.
2. The trigger for every CI/CD pipeline
A pipeline does not watch your folder. It watches a Git ref. A push to main, or a pull request opened against it, is the event that runs your tests and your deployment, which is why Git and continuous delivery are taught and examined together in the DOP-C02 half of a live AWS architecture and DevOps course. It is also why a sloppy branch strategy becomes a deployment problem rather than a tidiness problem.
Also read: What Is CI/CD? How the Pipeline Works, CI vs CD, and Your First Workflow in 2026.
3. AI work, with one firm boundary
Prompts, eval sets, agent tool definitions and chain configuration all belong in Git, and treating them as code is most of what separates a demo from something maintainable; that discipline runs through 360DT's live AI engineering program. Model weights and training datasets do not. Put a 4 GB checkpoint in a repository and every future clone downloads it forever, because history is immutable. Weights go in a registry, which is what an MLOps engineering track and the AI-300 objectives spend their time on. Git for what describes the model, a registry for the model.
How Far Git Scales: What Microsoft's Windows Repository Shows
The usual objection is that Git is fine for small projects and collapses on real ones. The counter-example is about as large as software gets. Microsoft's Azure DevOps blog, announcing Scalar, describes the Windows operating system repository as having an index of more than three million entries, with a complete object set of over 100 GB of compressed data. A clone pulls roughly 15 GB covering around 40 million commits and trees, and the client verifies about 90 million Git objects in the process.
The number that settles the scale question
If Git holds this, it will hold your repository
Compressed Git objects in the Windows OS repository, as reported on Microsoft's Azure DevOps blog when it introduced Scalar.
Figures as published by Microsoft's Azure DevOps blog, checked 14 November 2026.
Getting there took work you now inherit for free. Scalar began as a fork of VFS for Git, was reduced to a thin shell over core Git features, and per the GitHub Blog has been built into Git itself since v2.38. The commands that tame a monorepo are already on your machine:
# clone a very large repo with sparse checkout and background maintenance set up
scalar clone https://github.com/your-org/huge-monorepo
cd huge-monorepo/src
# or turn on scheduled maintenance in an existing repo
git maintenance start
You will not need either in your first year. It is worth knowing they exist, because "Git does not scale" is an objection you will hear from someone who last used it in 2013.
What Usually Goes Wrong With Git
Here is the honest desk warning. The thing that bites new users is almost never merging, which Git handles well. It is that git pull quietly does two things, fetch and then merge, and when your local branch has diverged it creates a merge commit you did not ask for. Three weeks of that and the history is a braid nobody can read. Set git config --global pull.rebase true on your first day and the problem disappears before you understand why it existed.
Four mistakes that cost real time
Each one is cheap to avoid and expensive to fix after the fact
Committing a secret
A connection string in a config file is now in the history permanently, and deleting it in a later commit changes nothing. Rotate the credential first, then rewrite history. Add a .gitignore before your first commit, not after.
Rotate, then rewriteCommitting large binaries
One 200 MB .pbix or a sample dataset makes every clone slower forever. Use Git LFS or keep the file out of the repository and reference where it lives.
History is foreverForce-pushing a shared branch
git push --force on main overwrites commits your teammates already have. Use --force-with-lease, which refuses if the remote moved since you last looked.
Panicking after a bad reset
A hard reset feels final and almost never is. Git keeps a log of every position HEAD has held, so the commit you think you destroyed is usually two commands away.
Check reflog firstBehaviour verified against Git 2.56.1 documentation on 14 November 2026.
$ git reflog
4d7e0b1 HEAD@{0}: reset: moving to HEAD~2
9c1f2ab HEAD@{1}: commit: Filter claims by region
$ git switch -c rescue 9c1f2ab
Switched to a new branch 'rescue'
| What you see | What actually happened | The fix |
|---|---|---|
! [rejected] main -> main (fetch first) |
Someone pushed while you were working |
git pull --rebase, then push again |
CONFLICT (content): Merge conflict in app.py |
Two branches changed the same lines | Edit the file, git add app.py, git commit
|
You are in 'detached HEAD' state |
You checked out a commit instead of a branch |
git switch -c fix-name to keep the work |
error: Your local changes would be overwritten |
Uncommitted edits block the switch |
git stash, switch, git stash pop
|
fatal: refusing to merge unrelated histories |
Two repositories with no shared commit |
git pull --allow-unrelated-histories, once |
-
Git's interface is genuinely bad, and that is not your fault.
git checkoutdid four unrelated jobs for a decade, which is whyswitchandrestorewere added to split it up.resetmeans three different things depending on a flag. If you are confused in week one, the tool is confusing, not you. - Some people should not bother. If you work alone on documents rather than code, file sync with version history does the job and Git will cost you more than it returns. The moment a second person edits the same file, that stops being true.
How to Learn Git Properly in 2026
My opinion, and I accept the trade-off: spend your first twenty hours in the terminal, not a GUI client. A graphical client is faster once you know what it does and actively harmful before that, because it hides which of the four areas a button touched. You will be slower for two weeks, then able to read any error message for the rest of your career.
The other call: skip interactive rebase in month one. Most teams' rebase rules are inherited habit rather than reasoning, and you cannot evaluate them until you can read a history graph. Learn merge properly, learn reflog, and come back to rebase when a real reason appears.
How to split your first 20 hours of Git practice
Weighted by how often each area actually comes up in a working week
Our recommended split for deliberate practice, based on how the commands come up in day-to-day work. This is editorial judgement, not survey data.
Git for Beginners: The Five Commands That Cover Most Days
git status before anything else, every time, until it is reflex. Then git add, git commit, git switch and git push. That is the working set. Read the output of git status properly and it tells you which of the four areas your changes sit in, and usually suggests the exact command to move them. It is the best teaching tool Git ships.
One more habit worth forming now that AI tooling writes a growing share of commits: review the diff before you stage it. An agent that edits eleven files and commits them under one message is how unreviewable history gets made, and writing commits that a human can audit is part of what the CCDV-F developer prep course treats as basic hygiene rather than polish.
Go from your first commit to a pipeline that deploys it
A live weekend program over 12 weeks that prepares you for both AWS Solutions Architect Associate (SAA-C03) and AWS DevOps Engineer Professional (DOP-C02). Includes hands on projects, mentor support and placement guidance.
Explore the course
What I Would Do In Your Position
Open a terminal tonight and run the worked example above. Not a video course: those thirty lines, by hand, until the four areas stop being an abstraction. Then put one real thing under version control this week, even if it is a folder of SQL files nobody else reads, and commit to it daily for a fortnight. Two weeks of small commits teaches more than a month of reading, because you finally have something to undo.
If you want the pipeline half of the picture with someone to ask questions of, sit in on a free webinar before you spend anything, or take the AWS architecture and DevOps course where Git, CI/CD and the DOP-C02 objectives are taught together on live weekends. You can also book a demo class and judge the teaching yourself. Either way, the commit comes first.
Related guides
- What Is Infrastructure as Code? once your code is in Git, this is the next thing that belongs there.
- What Is Containerization? the other half of why a push to main can safely become a deployment.
- Docker vs Kubernetes in 2026 which of the two to put your practice hours into after Git.
- SAA-C03 vs DOP-C02 if Git led you toward DevOps, this is the certification order question.
- DevOps Engineer Salary in India 2026 what the skill set Git sits inside is actually worth here.
- DevOps Jobs in Pune 2026 who is hiring for it in one of the markets where the roles concentrate.
Frequently asked questions
What is Git in simple words
Git is a program that takes a snapshot of your project every time you ask it to, and keeps every snapshot. That lets you see exactly what changed between any two points, work on an experiment without disturbing the working version, and go back to any earlier state. Because it is distributed, your copy contains the full history rather than a slice borrowed from a server.
Is Git the same as GitHub
No. Git is software you install and run on your own machine; GitHub is a website that hosts Git repositories and adds pull requests, code review and automation around them. GitHub has been owned by Microsoft since 2018. You can use Git with no account anywhere, and you can host your repositories on GitLab, Bitbucket, Azure Repos or your own server instead.
Do I need to learn Git before learning DevOps
Yes, and it is not close. A CI/CD pipeline is triggered by a Git event, infrastructure as code lives in a Git repository, and deployment approvals are expressed as branch policies. If branches and merges are still fuzzy, every DevOps topic above them stays fuzzy too. A week of deliberate Git practice before you start is the highest-return week in the whole path.
How long does it take to learn Git
About twenty hours of hands-on practice to be genuinely comfortable with the everyday loop, spread over two or three weeks so you accumulate a history worth reading. The first two hours get you committing. What takes longer is the mental model of the four areas, and that only arrives through repetition on a real project.
What is the difference between git fetch and git pull
git fetch downloads new commits and branch references from the remote and changes nothing in your working files. git pull does that fetch and then immediately integrates the result into your current branch, which is where surprise merge commits come from. Fetch first, look at what arrived with git log HEAD..origin/main, then integrate deliberately.
Can I use Git without the command line
You can, through VS Code's built-in source control, GitHub Desktop or similar clients, and plenty of professionals work that way. The catch is that a graphical client hides which area a button touched, so error messages become unreadable. Learn the commands for your first twenty hours, then use whatever interface you like.
What happens if I commit a password to Git
It stays in the history even after you delete it in a later commit, and anyone who has cloned the repository already has it. Treat the credential as compromised and rotate it first. Then rewrite the history with a tool built for it and force-push with --force-with-lease, warning your team beforehand. Adding a .gitignore before the first commit avoids all of this.
Is Git free to use
Yes. Git is free and open source under GPLv2, with no paid edition. The current release listed on git-scm.com is 2.56.1. Hosting is where costs appear: GitHub's Free plan includes a 12 US dollar monthly compute allowance for Actions and 500 MB of artifact storage pooled with Packages, per GitHub's billing documentation.
About this guide. 360 Digital Transformation is an Anthropic Partner and a Microsoft Authorized Training Partner. Other certification bodies, vendors and employers named here are not affiliated with us. Tools and versions change quickly; commands and figures cited were checked on 14 November 2026.


