When Git prints "HEAD detached", "hunk" or "upstream tracking", most beginners do not know exactly what it means, and guides often assume you already do. This page covers about 40 Git terms with a precise definition, the matching command and an example. Keep it as a reference: the other guides on the site link straight to the terms they use.
What you will learn
This page is organized by area:
- Internal objects: how Git really stores your data (blob, tree, SHA, packfile)
- Working areas: the states of your files between editing and commit
- Pointers: HEAD, branches, refs, ORIG_HEAD
- Index and changes: hunk, patch, stash, reflog
- Synchronization: remote, upstream, fetch, refspec
- History manipulation: rebase, cherry-pick, squash, reset, bisect
- Repositories and collaboration: bare repository, orphan branch, worktree, fork, pull request
- Advanced integration: submodule, subtree, hooks
Git internal objects
Git does not store files or diffs. It stores immutable objects in a local
database (the .git/objects/ folder). Everything Git knows is one of these
four object types.
Blob
A blob (Binary Large OBject) is the object that stores the raw content of a file. Not its name, not its permissions, only the bytes of the file. Two identical files in two different folders share the same blob object. This is automatic and transparent deduplication.
# Show the content of a blob (content of README.md at the HEAD commit)git cat-file -p HEAD:README.md
# Show the type of a Git objectgit cat-file -t abc1234# blobTree
A tree is the object that represents a directory. It contains a list of entries: each entry points to a blob (file) or to another tree (subfolder), with the name and the permissions.
A commit points to a root tree, which points to all the blobs and subtrees of the project. This tree structure is what makes up the full "snapshot" of the project at a given moment.
# Show the content of the root tree of the latest commitgit cat-file -p HEAD^{tree}# 100644 blob a8f1b3... README.md# 100644 blob 9c2d4a... package.json# 040000 tree 3f2c1e... srcCommit
A commit object is the snapshot of your project at a precise moment. It contains: a reference to the root tree, one or more references to its parent commits, and the metadata (author, date, message). Its SHA is not written in it: Git computes it from the content of the object.
A commit does not store a diff: it points to the complete tree. This lets Git rebuild the full state of the project at any moment without replaying all the diffs from the beginning.
# Show the internal content of a commitgit cat-file -p HEAD# tree 3f2c1e8a04b6...# parent abc12345def6...# author Jean Dupont <jean@example.com> 1711234567 +0100# committer Jean Dupont <jean@example.com> 1711234567 +0100## Ajout de la page d'accueilTag
A tag (label) marks a specific commit, usually a published version. There are two types:
| Type | Command | Separate object | Recommended for |
|---|---|---|---|
| Lightweight | git tag v1.0 | No | Quick local marking |
| Annotated | git tag -a v1.0 -m "Version 1.0" | Yes (with its own SHA) | Official releases |
Annotated tags are recommended for releases: they have their own SHA and
contain a message, a creation date and an author of their own. They can be
GPG-signed (-s) and they show up in git describe.
# Create an annotated taggit tag -a v2.1.0 -m "Release 2.1.0 : support multi-tenant"
# List tagsgit tag -l "v2.*"
# Show the details of an annotated taggit show v2.1.0SHA and hash
The SHA is the unique identifier of each Git object. It is a hash
computed from the complete content of the object. By default, Git uses
SHA-1 and the identifier is 40 hexadecimal characters long. A repository
created with git init --object-format=sha256 uses SHA-256, with
64-character identifiers. In both cases, the smallest change (one byte) gives
a completely different SHA.
# Full SHA of the current commit (40 characters in SHA-1)git rev-parse HEAD# e4a1c0f3d8b2a7f19c05d3e6b4a8f2c0e1d5b9a3
# Abbreviated SHA (7 characters, enough in practice)git rev-parse --short HEAD# e4a1c0fYou do not need all the characters. Git accepts any unambiguous prefix; 7 or 8 characters are usually enough. If two objects share the same prefix, Git asks you to make it longer.
The SHA plays two roles: it identifies the object and it lets you check its integrity. If an object is corrupted or altered during a transfer, its recomputed SHA no longer matches, and Git detects the error.
Packfile
A packfile is an optimized storage format that groups several Git objects
into a single compressed file. Git first stores each object separately in
.git/objects/, then periodically groups them into a packfile to save disk
space.
# Trigger the creation of a packfile manuallygit gc
# List the packfilesls -lh .git/objects/pack/# total 48M# -rw-r--r-- 1 bob bob 48M Mar 28 10:42 pack-abc123.pack# -rw-r--r-- 1 bob bob 512K Mar 28 10:42 pack-abc123.idxPackfiles use delta compression internally: instead of storing every version of a file in full, Git can store some objects as "base object + delta of changes". This is an implementation detail that is transparent to the user.
Delta
A delta is the representation of a Git object as the difference from another, base object, used inside packfiles to save space.
Working areas
Git manages your files through three distinct areas. Understanding these areas is the key to demystifying almost every Git command.
Working directory
The working directory is the folder of your project as you see it and edit it in your editor or terminal. This is where your real files live. Git watches for differences between the working directory and its index (staging area).
| File state | Meaning |
|---|---|
| Untracked | Git does not know this file yet |
| Modified | Changed since the last commit, not staged |
| Staged | Added to the staging area, ready for the commit |
| Committed | Recorded in the repository |
# Show the state of your working directorygit status
# Short versiongit status -s# M fichier.js ← left column = staged, right column = not staged# M autre.js# ?? nouveau.js ← untrackedStaging area
The staging area (also called the index) is the intermediate area between
the working directory and the repository. It holds the exact state of what
your next commit will be. git add moves files or parts of files into it;
git commit turns its content into a permanent commit.
Working directory →(git add)→ Staging area →(git commit)→ RepositoryWhy this intermediate step? It lets you commit only part of your changes,
even only part of a file with git add -p. If you changed 10 files, you can
create two clean commits by staging 5 files at a time.
# Show what is in the staging area (difference with the last commit)git diff --staged
# Remove a file from the staging area (without touching the working dir)git restore --staged fichier.js
# Show the index in detailgit ls-files --stageRepository
The repository is the Git database that stores the whole history of your
project. It lives in the .git/ folder at the root of your project. It
contains all the objects (blobs, trees, commits, tags), all the branches, all
the tags and the local configuration.
# The .git folder contains the whole databasels .git/# COMMIT_EDITMSG HEAD config hooks/ index objects/ refs/
# Show the size of the repositorydu -sh .git/Pointers and references
HEAD
HEAD is the pointer that tells you where you are in Git. In most cases,
HEAD points to the active branch (for example main), which itself points to
the latest commit of that branch. When you commit, HEAD (and therefore the
branch) moves forward automatically.
HEAD → main → commit e4a1c0f → commit parent → ...# Show what HEAD points tocat .git/HEAD# Show the SHA of the commit HEAD points togit rev-parse HEAD
# Use in commandsgit show HEAD # latest commitgit show HEAD~1 # one commit beforegit show HEAD~2 # two commits beforegit diff HEAD~1 HEAD # difference between the last two commitsDetached HEAD
The "detached HEAD" state means HEAD points directly to a commit, not to a branch. Normally, HEAD points to a branch that points to a commit. In detached HEAD, HEAD jumps over the branch and points directly to a SHA.
Normal : HEAD → main → e4a1c0fDetached : HEAD → e4a1c0f (no branch in between)When it happens: git checkout <sha>, git checkout <tag>, while
git rebase is running.
The risk: any commit created in detached HEAD belongs to no branch. If
you move elsewhere without creating a branch, those commits become orphaned
and will be deleted by git gc after 30 days.
# Git warns yougit checkout abc1234# HEAD is now at abc1234 Mon commit# You are in 'detached HEAD' state.
# Solution: create a branch to save the workgit switch -c branche-de-sauvegarde→ Dedicated guide: Detached HEAD: navigating without a branch (in French)
Ref
A ref (reference) is any symbolic name that points to a Git object, usually
a commit. Branches, tags, HEAD and the special references are all refs. Git
stores them in .git/refs/ as text files.
| Ref type | Examples | Location in .git/ |
|---|---|---|
| Local branch | main, feature/login | refs/heads/ |
| Remote branch | origin/main | refs/remotes/ |
| Tag | v1.0, v2.0-rc1 | refs/tags/ |
| HEAD | Current position | HEAD |
| Special | ORIG_HEAD, MERGE_HEAD | root of .git/ |
# Show all the refs of the repositorygit show-ref
# Resolve the SHA of a refgit rev-parse refs/heads/mainORIG_HEAD, MERGE_HEAD, FETCH_HEAD
Git creates temporary references to save important states. MERGE_HEAD
disappears at the end of the merge; ORIG_HEAD and FETCH_HEAD stay until
the next operation that rewrites them.
ORIG_HEAD: Git saves the old HEAD here before any risky operation (merge, rebase, reset). This lets you go back to the previous state with a single command.
# Before: git rebase main (which went wrong)git reset --hard ORIG_HEAD # back to the previous stateMERGE_HEAD: present during a merge with conflicts. Git stores there the
SHA of the branch being merged. It disappears after git commit or
git merge --abort.
FETCH_HEAD: contains the SHA of the remote branch fetched by the last
git fetch. git pull uses FETCH_HEAD to know what to merge after the fetch.
# Show the content after a fetchcat .git/FETCH_HEAD# abc1234 branch 'main' of https://github.com/user/projet.gitIndex and changes
Hunk
A hunk is a contiguous block of changed lines in a diff. A modified file can contain several hunks, separated by unchanged lines. Git uses this splitting so you can stage or skip changes block by block, not file by file.
@@ -15,4 +15,6 @@ def calculate(): result = 0- for i in range(10):+ for i in range(100):+ if i % 2 == 0:+ continue result += i return resultThe header @@ -15,4 +15,6 @@ reads: "in the original, this block starts at
line 15 and spans 4 lines; in the new version, it starts at line 15 and spans
6 lines". Count: 4 lines before (result = 0, for, result += i,
return), 6 after (the 2 extra lines that were added).
When you run git add -p, Git shows you the hunks one by one and asks, for
each one: stage it (y), skip it (n), split it into smaller ones (s) or
edit it manually (e).
# Stage hunk by hunkgit add -p
# Main prompt options# y = yes (stage this hunk)# n = no (skip this hunk)# s = split (split into smaller hunks)# e = edit (manually edit the lines to stage)# q = quit→ Dedicated guide: Interactive staging (in French)
Patch
A patch is a text file that contains one or more hunks, with the metadata needed to apply them to other code. It is the traditional exchange format in open source workflows (the Linux kernel in particular).
# Create a patch file for the last commitgit format-patch HEAD~1# 0001-Mon-commit.patch
# Apply a patchgit apply 0001-Mon-commit.patch
# Apply a patch with the commit metadata (author, date)git am 0001-Mon-commit.patchStash
The stash is a temporary stack where Git saves your uncommitted changes.
git stash records the state of the working directory and the staging area,
then puts everything back in the state of the last commit. git stash pop
reapplies the saved changes.
Modified working directory ↓ git stashClean working directory + stash holds your changes ↓ git stash popModified working directory (restored)# Set your changes asidegit stash
# Show the list of stashes (LIFO stack)git stash list# stash@{0}: WIP on main: e4a1c0f Ajout login# stash@{1}: WIP on feature: abc1234 En cours
# Restore the latest stashgit stash pop
# Name a stash (easier to read)git stash push -m "feature login - formulaire incomplet"
# Also stash untracked filesgit stash -u
# Restore a specific stash without deleting itgit stash apply stash@{1}→ Dedicated guide: Git stash and git clean (in French)
Reflog
The reflog (reference log) is the journal of all the movements of HEAD and
of the branches in your local repository. Each time HEAD changes (commit,
checkout, merge, rebase, reset), Git records an entry in the reflog. It is
kept 90 days by default, and only 30 days for an entry that has become
unreachable from the references (gc.reflogExpireUnreachable).
It is your safety net. A commit "lost" after a reset --hard? A commit
created in detached HEAD and abandoned? Everything is in the reflog as long as
the delay has not expired.
# Show the reflog of HEADgit reflog# e4a1c0f HEAD@{0}: commit: Ajout de la page d'accueil# 3f2c1b0 HEAD@{1}: checkout: moving from feature to main# abc1234 HEAD@{2}: reset: moving to HEAD~1# def5678 HEAD@{3}: commit: Feature login
# Recover the "lost" commit: the one from before the reset (def5678)git switch -c branche-rescue def5678→ Dedicated guide: Recovering lost data (in French)
Remote synchronization
Remote
A remote is a Git repository hosted elsewhere, on GitHub, GitLab, an internal server, or even another folder on your machine. In your local repository, a remote is a named reference to the URL of that remote repository. You can have several in the same project.
# Show the configured remotesgit remote -v# origin https://github.com/user/projet.git (fetch)# origin https://github.com/user/projet.git (push)
# Add a remotegit remote add backup https://gitlab.com/user/projet.git
# Rename a remotegit remote rename origin ancien-origin
# Remove a remotegit remote remove backupOrigin
Origin is the conventional name of the main remote, typically the
repository you cloned from. This name is not mandatory: it is a convention
followed by Git and all the tools. git clone creates it automatically. You
can rename it or use another one.
# Origin is created automatically by git clonegit clone https://github.com/user/projet.gitcd projetgit remote -v# origin https://github.com/user/projet.git (fetch)# origin https://github.com/user/projet.git (push)Upstream
The term "upstream" has two meanings depending on the context:
1. The remote branch tracked by a local branch. When you run
git push -u origin main, you configure origin/main as the upstream of your
local main. After that you can use git push and git pull without
arguments.
# Configure the upstream of a branchgit push -u origin feature/login
# Show the configured upstream of each local branchgit branch -vv# * main e4a1c0f [origin/main] Mon commit# feature abc1234 [origin/feature: ahead 2] Ma feature# "ahead 2" = 2 local commits not pushed yet# "behind 3" = 3 remote commits not fetched yet2. The original repository in a fork workflow. If you fork a project on GitHub, the original repository is conventionally called "upstream" and your fork is called "origin".
# Classic fork configurationgit remote add upstream https://github.com/projet-original/projet.gitgit remote add origin https://github.com/votre-fork/projet.git
# Fetch the updates of the originalgit fetch upstreamgit merge upstream/mainTracking branch
A tracking branch is a local branch configured to follow a remote branch.
It automatically knows where git push must send and where git pull must
fetch from.
# Create a local branch that tracks a remote branchgit switch --track origin/feature-xyz# Branch 'feature-xyz' set up to track remote branch 'feature-xyz' from 'origin'.
# Show all the branches and their trackinggit branch -vvFetch
git fetch downloads the new data from the remote without changing your
working directory or your local branches. It updates the remote references
(origin/main, etc.) but does not touch your local main. git pull is
essentially git fetch + git merge.
Before fetch: origin/main out of sync with the server ↓ git fetchAfter fetch : origin/main = current state of the server local main = unchanged (you decide when to merge)# Download without merginggit fetch origin
# See what changed upstream before decidinggit log HEAD..origin/main --oneline
# Then merge manuallygit merge origin/main# (or: git pull = fetch + merge in one command)Refspec
A refspec is the syntax that defines which references to transfer between
the local repository and the remote. Format: [+]<src>:<dst>. It appears in
the .git/config configuration and in the git fetch and git push
commands.
# Standard refspec created by git clone (in .git/config)# fetch = +refs/heads/*:refs/remotes/origin/*# Means: fetch all the branches of the remote (refs/heads/*)# and store them locally under refs/remotes/origin/*
# Push a local branch to a different name on the remotegit push origin feature:feature-v2
# Delete a remote branch (empty source)git push origin :ancienne-branche# equivalent:git push origin --delete ancienne-brancheManipulating history
Fast-forward
A fast-forward is a type of merge where Git simply moves the branch pointer forward without creating a merge commit. It is only possible when the branch to integrate is directly ahead of the target branch, with no divergence: in other words, all the commits of the target are already ancestors of the source branch.
Before fast-forward: A ──► B ──► C ──► D ▲ ▲ main feature
git merge feature (from main)
After fast-forward: A ──► B ──► C ──► D ▲ main, feature (main just "moved forward" to D, without a merge commit)# Merge as a fast-forward (default behavior when possible)git merge feature
# Force a merge commit even if fast-forward is possiblegit merge --no-ff feature
# Refuse if fast-forward is not possiblegit merge --ff-only feature→ Dedicated guide: Merge and conflicts (in French)
Rebase
git rebase replays your commits on a new base. Instead of creating a
merge commit, it moves your commits (by recreating them with new SHAs) as if
they had been created after the commits of the target branch.
Before rebase: main ──► A ──► B ──► C feature ──► A ──► D ──► E
git rebase main (from feature)
After rebase: main ──► A ──► B ──► C feature ──────────────────► D' ──► E' (D' and E' are new versions of D and E, with new SHAs)# Rebase the current branch onto maingit rebase main
# Interactive rebase: reorder, squash, edit commitsgit rebase -i HEAD~5
# Cancel a rebase in progressgit rebase --abort
# Continue after resolving a conflictgit rebase --continue→ Dedicated guide: Rebase fundamentals (in French)
Cherry-pick
git cherry-pick copies a specific commit and applies it to the current
branch. It recreates the commit with a new SHA (since the context is
different). Useful for backports (porting a fix to a maintenance branch) or
targeted hotfixes.
main ──► A ──► B ──► C ──► Dfeature ──► A ──► X ──► Y
git cherry-pick D (from feature)
feature ──► A ──► X ──► Y ──► D'(D' is a copy of D with a new SHA)# Apply a specific commit to the current branchgit cherry-pick abc1234
# Apply a range of commitsgit cherry-pick abc1234..def5678
# Cherry-pick without creating a commit (resolve manually)git cherry-pick --no-commit abc1234→ Dedicated guide: Cherry-pick (in French)
Squash
Squashing commits means combining them into a single commit. It is an
operation of git rebase -i: you select several commits and merge them into
one commit with a combined or new message. Useful for cleaning up a series of
"WIP" commits before merging.
Before squash: A ──► B ──► C ──► D (B, C, D are "WIP: in progress")
git rebase -i HEAD~3 (with squash on C and D)
After squash: A ──► E (E is a clean commit that combines B+C+D)# Open the editor for the last 3 commitsgit rebase -i HEAD~3
# In the editor, change "pick" to "squash" or "s"# pick abc1234 Feature principale# squash def5678 WIP: ajout test# squash ghi9012 WIP: fix lint→ Dedicated guide: Rewriting history (in French)
Revert
git revert undoes a commit by creating a new commit that applies the
inverse of the changes. Unlike reset, it does not modify the existing
history, it adds an undo commit to it. It is the safe way to undo on a shared
branch.
# Undo the last commit (creates a new undo commit)git revert HEAD
# Undo a specific commit in the historygit revert abc1234
# Prepare the revert without creating the commit right awaygit revert --no-commit abc1234git revert --no-commit def5678git commit -m "Annulation des features X et Y"Reset
git reset moves the current branch (and therefore HEAD) to an earlier
commit. It has three modes that differ by their impact on the staging area
and the working directory:
| Mode | Command | Staging area | Working directory |
|---|---|---|---|
| Soft | git reset --soft HEAD~1 | Preserved | Preserved |
| Mixed (default) | git reset HEAD~1 | Emptied | Preserved |
| Hard | git reset --hard HEAD~1 | Emptied | Reset |
# Undo the last commit, keeping the changes in the staging areagit reset --soft HEAD~1
# Undo the last commit, putting the changes back in the working directorygit reset HEAD~1
# Undo and DISCARD all changes (irreversible without the reflog)git reset --hard HEAD~1→ Dedicated guide: Reset demystified (in French)
Bisect
git bisect finds the commit that introduced a bug using binary search.
You give it a "good" commit (before the bug) and a "bad" commit (with the
bug). Git picks the middle commit, you test it, mark it good or bad, and so
on. For n commits, it takes about log2(n) steps to isolate the faulty commit.
Commits: A B C D E F G H I J K LA is good, L is bad.
Bisect tests F (middle) → "good"Bisect tests I → "bad"Bisect tests G → "bad"Result: F is good and G is bad, so G is the first bad commit.# Start a bisect sessiongit bisect start
# Mark the current commit as badgit bisect bad
# Mark an old, known commit as goodgit bisect good v2.0
# For each commit proposed by Git: test and answergit bisect good # orgit bisect bad
# Finish and go back to the normal branchgit bisect reset
# Automate with a test script (0 = good, non-0 = bad)git bisect run npm test→ Dedicated guide: Debugging with bisect and blame (in French)
Repositories and collaboration
Bare repository
A bare repository is a Git repository without a working directory. It only
contains what is in the .git/ folder of a normal repository. This is the
type of repository used on Git servers (GitHub, GitLab, your internal server):
it receives pushes and serves clones, but nobody works directly in it.
# Create a bare repository (to serve as a remote)git init --bare mon-projet.git
# Clone while keeping the bare formatgit clone --bare https://github.com/user/projet.git→ Dedicated guide: Hosting your own Git server (in French)
Orphan branch
An orphan branch is a branch with no common history with the rest of the
repository. Its first commit has no parent. Useful for creating a gh-pages
branch (documentation) or a docs branch entirely independent of the source
code.
# Create an orphan branch (without history)git switch --orphan gh-pages
# The branch is empty and has no parentgit status# On branch gh-pages## No commits yetWorktree
git worktree lets you have several working directories attached to the
same repository at the same time. You can work on two different branches in
two separate folders, without stash and without an extra clone.
# Create a second working directory on the "hotfix" branchgit worktree add ../projet-hotfix hotfix/urgent
# Show all the active worktreesgit worktree list# /home/bob/projet e4a1c0f [main]# /home/bob/projet-hotfix abc1234 [hotfix/urgent]
# Remove a worktreegit worktree remove ../projet-hotfixThe guide Git worktree: several branches at the same time (in French) covers the creation step by step, what worktrees really share and the pitfalls to know about (dependencies, untracked files, shared hooks).
Fork
A fork is a copy of a repository on a platform (GitHub, GitLab). Unlike a local clone, a fork is an independent remote repository under your account. It is used in the open source contribution workflow: you fork, work on your fork, then propose your changes through a pull request to the original repository.
# After forking on GitHub, clone your forkgit clone https://github.com/VOTRE-COMPTE/projet.gitcd projet
# Add the original repository as "upstream"git remote add upstream https://github.com/ORIGINAL/projet.git
# Fetch the updates of the originalgit fetch upstreamgit merge upstream/mainPull Request and Merge Request
A Pull Request (PR on GitHub) or Merge Request (MR on GitLab) is a formal request to merge one branch into another, with a code review interface, comments, CI/CD pipelines and a validation before the merge. It is not a feature of Git itself, it is a layer added by the hosting platforms.
| Platform | Term | Acronym |
|---|---|---|
| GitHub | Pull Request | PR |
| GitLab | Merge Request | MR |
| Bitbucket | Pull Request | PR |
| Azure DevOps | Pull Request | PR |
→ Dedicated guide: Pull requests and code review (in French)
Advanced integration
Submodule
A submodule is a Git repository nested inside another Git repository. The parent repository stores a pointer to a precise SHA of the sub-repository (not its content). Useful for referencing an external library while pinning a precise version.
# Add a submodulegit submodule add https://github.com/lib/librairie.git libs/librairie
# Clone a repository with its submodulesgit clone --recurse-submodules https://github.com/user/projet.git
# Update all the submodules to their latest versiongit submodule update --remote→ Dedicated guide: Git submodules (in French)
Subtree
git subtree integrates the content of an external repository directly into
a subfolder of your repository. Unlike submodules, the files are copied and
become part of your repository's history. Simpler day to day, because
contributors do not need any special command to clone.
# Add a sub-project as a subtreegit subtree add --prefix=libs/ma-lib \ https://github.com/lib/ma-lib.git main --squash
# Update the subtreegit subtree pull --prefix=libs/ma-lib \ https://github.com/lib/ma-lib.git main --squash→ Dedicated guide: Git subtree (in French)
Hooks
Git hooks are scripts run automatically on specific Git events, before a
commit, after a push, before a merge, and so on. They are stored in
.git/hooks/ and are local (not versioned by default).
| Hook | Trigger | Common use cases |
|---|---|---|
pre-commit | Before each commit | Lint, formatting, quick tests |
commit-msg | Message validation | Conventional Commits format |
pre-push | Before each push | Integration tests |
post-merge | After a successful merge | Dependency update |
prepare-commit-msg | When the commit editor opens | Pre-fill the message |
# Create a pre-commit hook (example: run eslint)cat > .git/hooks/pre-commit << 'EOF'#!/bin/shnpm run lintexit $?EOFchmod +x .git/hooks/pre-commitKey takeaways
| Term | One-sentence definition |
|---|---|
| Blob | Raw content of a file in the Git database |
| Tree | Directory in the Git database |
| SHA / hash | Unique identifier of each object (40 characters in SHA-1, 64 in SHA-256) |
| Packfile | Optimized, compressed storage format for Git objects |
| Working directory | Your files as you see and edit them |
| Staging area / Index | Intermediate area between editing and commit |
| Repository | The Git database (the .git/ folder) |
| HEAD | Pointer to your current position in the history |
| Detached HEAD | HEAD points to a commit, not to a branch |
| Ref | Any symbolic name pointing to a Git object |
| ORIG_HEAD | Automatic backup of HEAD before a risky operation |
| Hunk | Contiguous block of changed lines in a diff |
| Stash | Temporary stack of uncommitted changes |
| Reflog | Local journal of all HEAD movements (90 days, 30 if the entry has become unreachable) |
| Remote | Named reference to a remote Git repository |
| Origin | Conventional name of the main remote |
| Upstream | Tracked remote branch / original repository of a fork |
| Fetch | Download remote data without merging |
| Refspec | src:dst syntax for reference transfers |
| Fast-forward | Merge without a merge commit (simple pointer move) |
| Rebase | Replay commits on a new base |
| Cherry-pick | Copy a specific commit onto the current branch |
| Squash | Combine several commits into one |
| Revert | Undo a commit by creating an undo commit |
| Reset | Move the current branch (and HEAD) to an earlier commit |
| Bisect | Binary search for the faulty commit |
| Bare repository | Repository without a working directory (used on servers) |
| Fork | Copy of a repository on a platform (GitHub, GitLab) |
| Pull Request / MR | Formal merge request with code review |
| Submodule | Git repository nested inside another one |
| Hooks | Scripts run automatically on Git events |
Knowledge check
Check that you have the essentials of this guide. The questions only cover what has just been explained here.
Knowledge check
Check what you have learned with this interactive quiz
How it works
- The timer starts when you click Start
- Multiple choice, true/false and short answer questions
- You can move between questions
- Detailed results are shown at the end
Starts the quiz and the timer
Review
(0/0)Result saved on this device. It will be sent to your account at the next sync. Sync now
Score by domain
A domain groups several guides and gets several questions, so its score is more reliable than a per-topic score, which often rests on a single question.
Summary
Strengths
No topic passed at 80% on at least two questions yet.
Weak areas
No topic below the pass mark.
Recommended next
Hints before you try again?
A new full quiz with random questions
Work again only on the questions you missed