Skip to content

Glossary

Short definitions for the Git and GitHub terms used across this handbook. Each one links back to the chapter that teaches it in full.

branch

A branch is a movable label pointing at a commit, letting you work on a line of history separate from the rest of the project. Creating one does not copy any files; it adds a pointer you can move independently by committing on it. See Branches.

clone

git clone <url> copies a remote repository onto your own machine, including its complete history, ready to work with right away. See Your first repository.

commit

A commit is a saved snapshot of your project: every tracked file as it stood at that moment, a message describing what changed, and a link back to the commit before it. See The commit loop.

detached HEAD

Detached HEAD is what happens when HEAD points directly at a commit instead of at a branch, usually because you checked out a specific commit rather than a branch name. Commits made there sit outside any branch, so they can be tricky to find again once you switch away. See Branches.

fetch

git fetch downloads new commits from a remote without merging them into your current branch. It only updates your remote-tracking branches, like origin/main. See Remotes and GitHub.

fork

A fork is your own copy of someone else's repository on GitHub, used when you want to contribute to a project you do not have push access to. See The pull request flow.

.gitignore

.gitignore is a file listing patterns for what Git should never track, such as dependency folders and files holding secrets. It only affects files Git is not already tracking. See Ignoring files and good habits.

HEAD is Git's pointer to whatever commit you currently have checked out. Most of the time it points at your current branch, which in turn points at a commit. See Branches.

main

main is the conventional name for a repository's default branch. Older repositories and tutorials sometimes use master for the same role. See Your first repository.

merge

git merge <branch> brings another branch's commits into your current branch, combining the two histories into one. See Merging and conflicts.

merge conflict

A merge conflict happens when two branches change the same lines of a file and Git cannot combine them automatically. Git marks the conflicting spot with <<<<<<<, =======, and >>>>>>> and waits for you to choose the right result. See Merging and conflicts.

origin

origin is the conventional name Git gives the remote a repository was cloned from. It is a name only; you can rename it or add other remotes freely. See Remotes and GitHub.

pull

git pull fetches new commits from a remote and merges them into your current branch in one step. See Remotes and GitHub.

pull request

A pull request (PR) is a request on GitHub to merge one branch into another, opened for discussion and review before the merge happens. See The pull request flow.

push

git push sends your local commits up to a remote, so a host like GitHub, or a collaborator, can see them. See Remotes and GitHub.

rebase

Rebasing replays your branch's commits on top of a different starting point, producing a straight line of history in place of a merge commit. It rewrites commit history, so save it for branches nobody else has already built on. See Merging and conflicts.

reflog

The reflog is a local record of everywhere HEAD has pointed recently, including commits a branch no longer reaches. It is how you recover a commit after a reset or a deleted branch, until Git eventually cleans it up. See Undoing things.

refspec

A refspec is a mapping, stored in a remote's config, that tells git fetch which branches on the remote to download and which remote-tracking branches to record them under. See Remotes and GitHub.

remote

A remote is a copy of a repository hosted somewhere else, usually reached over a URL. GitHub is one popular place to host a remote, alongside options like GitLab and Bitbucket. See Remotes and GitHub.

remote-tracking branch

A remote-tracking branch, like origin/main, is your repository's local record of where a branch on a remote stood the last time you fetched or pulled. It never updates on its own; only a fetch or pull moves it. See Remotes and GitHub.

repository

A repository, or repo, is a project folder Git is tracking, along with the complete history of every commit made in it. See Your first repository.

reset

git reset moves your current branch to point at a different commit. --soft leaves the staging area and working directory untouched, --mixed also clears the staging area, and --hard overwrites the working directory too, discarding uncommitted changes, so treat it with care on any branch you have already shared. See Undoing things.

revert

git revert <commit> creates a new commit that undoes the changes from an earlier one, leaving the original commit in place. It is the safe way to undo something already on a shared branch. See Undoing things.

staging area (index)

The staging area, also called the index, is where you line up exactly what the next commit will contain. git add moves changes from your working directory into the staging area, and git commit saves what is staged. See The commit loop.

stash

git stash shelves your uncommitted changes so you can switch tasks with a clean working directory, then bring them back later with git stash pop. See Undoing things.

tag

A tag is a fixed label pinned to one commit, most often marking a release. Unlike a branch, it does not move when new commits are made. See Branches.

terminal

The terminal is the app where you type commands as text, including every git command, and read what they print back. Also called the command line. See Your first repository.

upstream

A branch's upstream is the remote branch it tracks, usually set with git push -u. Once it is set, plain git push and git pull work on that branch without naming the remote and branch each time. See Remotes and GitHub.

working directory

The working directory is the actual folder of files on your disk, the one open in your editor. It holds whatever state your files are in right now, whether or not any of that has been staged or committed. See The commit loop.