Skip to content

Command Line and Git

Glossary

134 terms from Command Line and Git, in plain words, each with the chapter that teaches it.

#

--help
An option most commands accept that prints a summary of how to use them. For Git, `git help command` shows the manual page.
.gitignore
A file in a repository that lists names and patterns Git should ignore, such as generated files, secrets and system clutter. It only affects files not yet tracked.
~/.bashrc and ~/.zshrc
Hidden settings files in your home folder that the shell runs when it starts. They hold lines like `export EDITOR=nano` and aliases.

A

absolute path
A path that starts with `/` and gives the full route from the root folder, such as `/Users/sam/kc/notes`. It means the same place wherever you are.
alias
A short name you define for a longer command. After `alias ll='ls -la'`, typing `ll` runs `ls -la`.
argument
The thing a command works on, typed after the command name. In `echo Hello`, `Hello` is the argument.

B

bash
A common shell, the program that reads and runs your typed commands. It is used on Linux and in Git Bash on Windows.
branch
A named line of commits. A branch lets you try a change without disturbing `main`, and it is really just a movable label pointing at a commit.
builtin
A command that is part of the shell itself, such as `cd`. Other commands like `git` are separate program files.

C

cat
Prints a whole file to the screen. Given several files, it prints them one after another.
cd
Moves the shell into another folder. `cd` alone goes home, `cd ..` goes up one folder and `cd -` goes back to the previous folder.
clone
A copy of a remote repository including its whole history. `git clone URL` makes one and sets up `origin` and tracking for you, as Priya did to get the price list.
command history
The list of commands you have typed before. Press the Up and Down arrows to step through them, or type `history` to list them all.
command line
Controlling the computer by typing commands rather than clicking. It is the general idea behind the terminal and shell.
comment
A line or part of a line that a program or tool ignores, there for human readers. In shell scripts, Python and `.gitignore`, a comment starts with `#`.
commit
A saved snapshot of the files in a repository, with a message, the author, the date and a unique hash. `git commit -m "message"` creates one from what is staged.
commit message
The note attached to a commit explaining what it does. A good one has a short, command-style summary line and, when needed, a body explaining why.
conflict
What happens when two branches changed the same lines and Git can't tell which version is right. You edit the file to the correct version, then `git add` and `git commit`.
conflict markers
The `<<<<<<<`, `=======` and `>>>>>>>` lines Git writes into a file during a conflict, showing both competing versions. You delete them after choosing the final text.
cp
Copies a file to a new name or into a folder. Add `-r` to copy a folder; it overwrites without asking unless you use `-i`.
CSV
A plain text table with one row per line and commas between columns, like Kettle & Crane's `products.csv`. Spreadsheets and programming languages can read it.
Ctrl+C
A key combination that stops whatever is running and gives you a fresh prompt. Use it when the terminal seems stuck; it does not copy in a terminal.
cut
Picks out columns from each line of text. `cut -d , -f 3` splits on commas and keeps the third field.

D

dict
Python's lookup table of names and values. In `ship.py`, `BASE` is a dict from state codes to shipping dollars.
diff
A line-by-line description of changes: lines starting with `-` were removed, lines starting with `+` were added and the rest are unchanged context. `git diff` shows one.
directory
Another word for a folder. The working directory is the folder the shell is currently in.
draft pull request
A pull request marked as not ready yet. It can't be merged until you mark it ready for review.

E

echo
Prints back whatever you give it. It is handy for checking variables and for writing text into files with `>`.
editor
A program for writing and changing text files. nano is a simple editor that runs inside the terminal, and Git opens your configured editor when it needs you to write a message.
environment variable
A named setting that the shell provides and every program you run can read, such as `HOME` or `PATH`. `export` makes your own variable visible to programs.
exit code
A number a program gives the shell when it finishes: 0 means success and anything else, such as the 1 in `sys.exit(1)`, means it failed.
export
Makes a shell variable visible to the programs you start. For example, `export EDITOR=nano` tells Git which editor you prefer.

F

fast-forward
A merge where the receiving branch hasn't moved, so Git just slides its label forward and creates no merge commit.
fetch
Downloads new commits from a remote without changing your files, so you can see what's coming. `git pull` is fetch plus merge.
file permissions
Letters in `ls -l` output showing who may read (`r`), write (`w`) and run (`x`) a file. The first character is `d` for a directory and `-` for an ordinary file.
find
Searches for files by name or type through a folder and everything below it. For example, `find . -name "*.csv"` lists every CSV file under the current folder.
fork
Your own copy of someone else's repository on GitHub. It is used when you can't push to the original and want to open a pull request from your copy.

G

Git
The version control tool that almost every software team uses. It runs on your own computer and records the history of a folder.
git add
Puts changes into the staging area for the next commit. Give it file names, or `.` for everything in the current folder.
Git Bash
A terminal program installed with Git for Windows that runs the bash shell. It lets Windows users type the same Unix-style commands used on macOS and Linux.
git branch
Lists branches, with `*` beside the current one. `git branch -d name` deletes a merged branch and refuses if its work isn't merged.
git commit --amend
Replaces the last commit with a corrected one, to fix a message or add a forgotten file. It changes the hash, so don't use it on commits you've already pushed.
git commit -am
Stages every change to files Git already tracks and commits them in one step. It never adds new, untracked files.
git config
Sets Git options such as your name and email. With `--global` the settings apply to every repository on your computer.
Git Credential Manager
A helper that signs Git in to GitHub through your browser and stores the credentials safely. It comes with Git for Windows.
git diff
Shows what changed. Plain `git diff` shows unstaged changes, `--staged` shows what the next commit will contain and `--stat` summarizes changes per file.
git init
Turns the current folder into a Git repository by creating a hidden `.git` folder.
git log
Lists commits, newest first. `--oneline` gives one line per commit, `--graph` draws the branches and `--all` includes every branch.
git merge
Brings another branch's commits into the branch you're on. If it gets messy, `git merge --abort` puts everything back as it was.
git pull
Downloads new commits from the remote and merges them into your branch. It is fetch followed by merge.
git push
Uploads your commits to a remote such as GitHub. Pull is the opposite direction: download and merge other people's commits.
git remote
Manages the remotes connected to a repository. `git remote add origin URL` saves an address under the name `origin`, and `-v` lists them.
git reset --hard
Moves the current branch back to a chosen commit and makes every file match it, deleting uncommitted changes without asking. It is the dangerous way to undo work, because discarded changes can't be recovered.
git restore
Discards unstaged edits by putting a file back as in the last commit, which can't be undone. With `--staged` it only unstages, and with `--source=hash` it gets an old version.
git revert
Makes a new commit that does the exact opposite of an earlier commit. It is safe on shared history because nothing is rewritten.
git rm --cached
Stops Git tracking a file but leaves it on disk. Use it when a file was committed before you added it to `.gitignore`.
git show
Displays one commit with its details and diff. `git show hash:file` prints a file as it was in that commit.
git status
Shows which branch you're on and which files are changed, staged or untracked. `--short` gives one line per file.
git switch
Moves you to another branch and changes your files to match it. `git switch -c name` creates the branch first, and `git checkout` is the older equivalent.
GitHub
A website that hosts online copies of Git repositories and adds tools like pull requests. GitLab and Bitbucket are similar services.
GitHub CLI
GitHub's own command-line tool, `gh`. Running `gh auth login` signs Git in to your GitHub account.
grep
Prints every line of a file that contains the text you give it. Options include `-i` (ignore case), `-c` (count), `-n` (line numbers), `-v` (non-matching) and `-r` (search folders).

H

hash
A commit's unique ID, a 40-character code calculated from its contents, such as `b2c81a6` when shortened. The first seven characters are enough to name a commit.
head
Shows the first lines of a file, 10 by default. `-n` sets how many.
HEAD
The commit you're on now, usually the newest on your current branch. `HEAD~1` means one commit before it.
hidden files
Files whose names start with a dot. `ls` leaves them out unless you use `-a`, and Git's `.git` folder is one.
home folder
The folder that holds your Desktop, Documents and Downloads, where the shell starts. `~` is the shortcut for it.
Homebrew
A free package manager for macOS. Once installed, `brew install git` installs programs.
HTTPS
The secure web protocol, one of two ways to connect Git to GitHub. HTTPS remote addresses start with `https://`.

I

IndexError
A Python error that means you asked for a list item that doesn't exist. It shows up when `sys.argv[1]` is used but no arguments were given, and Python prints a traceback with it.

L

less
Shows a file one screen at a time. Space moves on, `/` searches and `q` quits.
ls
Lists what's in a folder. `-l` gives details, `-a` includes hidden files and `-F` marks folders with `/`.

M

man
Opens the full manual for a command in a pager. `man ls` shows the manual for `ls`, and `q` quits.
Markdown
A simple way to format plain text with symbols, such as `#` for a heading. Files ending in `.md` are Markdown, and GitHub shows a repository's `README.md` on its front page.
merge
Combining one branch's commits into another. Merge from the branch that is receiving the work.
merge commit
A commit that joins two branches that have both moved on. It has two parents.
mkdir
Creates a folder. With `-p` it also creates any missing parent folders and doesn't complain if the folder exists.
mv
Moves a file or folder, or renames it if the destination is a new name in the same folder. It replaces existing files silently unless you use `-i`.

N

nano
A simple text editor that runs inside the terminal and lists its main keys at the bottom. Ctrl+O saves and Ctrl+X exits.

O

option
A setting that changes how a command behaves. It starts with `-` for short names (`-F`) or `--` for long ones (`--version`).
origin
The usual name for a repository's main remote. `origin/main` is Git's record of where `main` was on the remote when you last connected.

P

package manager
A program that installs and updates software, such as `apt` or `dnf` on Linux and Homebrew on macOS.
pager
A program for reading long output one screen at a time, such as `less`. If you're stuck in one, press `q`.
path
The route to a file or folder through the folder tree, with `/` between steps, such as `/Users/sam/kc/notes/todo.txt`.
PATH
An environment variable listing the folders the shell searches, in order, to find the program for a command you type.
personal access token
A long, limited-purpose password you generate on GitHub and give to Git instead of your account password.
pipe
The `|` symbol that feeds one command's output into the next command as input. Chaining several is called a pipeline.
plain text file
A file containing only characters, with no fonts or formatting. Code, notes and CSV files are plain text, while Word and `.xlsx` files are not.
PowerShell
Microsoft's own Windows command-line shell. Some of its command names match those of bash, but it works differently, so bash commands won't always work in it.
prompt
The line ending in a symbol such as `$` or `%` where the shell waits for your next command. It usually shows your user name, computer name and folder.
pull request
A GitHub page asking for a branch to be merged into `main`. It shows the diff and lets teammates comment and approve.
pwd
Prints the folder the shell is currently in.

Q

quoting
Putting text in quotes so the shell treats it exactly as typed, for example `"Kettle & Crane"` or `"price lists"`. Double quotes still expand `$variables`; single quotes don't.

R

README
A text file describing a project, which GitHub displays on the repository's front page.
redirection
Sending a command's output to a file instead of the screen. `>` creates or replaces the file and `>>` appends to it.
reflog
Git's list of every commit `HEAD` has recently pointed to, including ones no branch shows any more. It can rescue commits that seem lost.
relative path
A path that doesn't start with `/` and is read from your current folder. From `/Users/sam/kc`, `notes` means `/Users/sam/kc/notes`.
remote
Another copy of a repository somewhere else, usually on GitHub. It acts as a backup and a shared place for a team.
repository
A folder whose history Git tracks. Git keeps that history in a hidden `.git` folder inside it.
revert
A new commit that undoes an earlier one without rewriting history, so it is safe on shared work.
rm
Deletes files permanently, with no Trash and no undo. `-r` deletes folders and their contents, `-i` asks first and `-rf` removes all warnings and is dangerous.
rmdir
Removes an empty folder, and refuses if anything is inside. That makes it a safe way to delete folders.
root
The single top folder of the file tree, written `/`, from which every absolute path starts.
root commit
The very first commit in a repository, which has no earlier commit before it.

S

secrets
Passwords, API keys and similar private values. Never commit them, even to a private repository: keep them in a file such as `.env` and list it in `.gitignore` before your first commit.
shell
The program inside the terminal that reads your commands and runs them, such as bash or zsh.
shell script
A text file of shell commands that the shell runs one after another, such as `weekly.sh`. You run it with `bash weekly.sh`.
shell variable
A named value you set with `name=value`, with no spaces around `=`, and use with a `$` in front. The shell swaps in the value before running the command.
SKU
A short product code, such as `ESP-5LB` for House Espresso in a 5 lb bag, used to identify each Kettle & Crane product.
sort
Sorts lines of text alphabetically. `-n` sorts by number and `-r` reverses the order.
Squash and merge
Alternative ways to merge a pull request on GitHub. Squash and merge combines the branch's commits into one, while Rebase and merge copies them onto `main` without a merge commit.
SSH
A secure way for computers to connect, using a private key that stays on your computer and a public key you give GitHub. `ssh-keygen` creates the key pair.
staging area
The place where you collect the changes you want in the next commit. It lets you commit only some of your changed files.
stash
A safe place to put uncommitted changes aside. `git stash` stores them and `git stash pop` brings them back.
sudo
Runs a command with administrator rights, so it asks for your password. Nothing shows as you type the password.
sys.argv
The Python list of words typed after `python3`. `sys.argv[1]` is the first argument after the script's name.

T

tab completion
Pressing Tab fills in the rest of a file or folder name. Press Tab twice to list the matches.
tag
A permanent name for one commit, usually a version number such as `v1.0`. Unlike a branch, it never moves, and it must be pushed by name.
tail
Shows the last lines of a file. `tail -n +2` skips the header, and `tail -f` keeps showing new lines of a log file.
terminal
A window where you control the computer by typing commands and reading text replies.
touch
Creates an empty file if it doesn't exist. If it does, it only updates the file's last-changed time.
tracking
The link between a local branch and a remote one, such as `main` and `origin/main`. `-u` on the first push sets it up so plain `git push` and `git pull` work.

U

uniq
Removes repeated lines that sit next to each other, and `-c` counts them. You usually sort first.
untracked file
A file Git can see but isn't keeping history for yet. `git add` starts tracking it.

V

version control
Recording every saved version of a project's files, including who changed what, when and why, so you can return to any earlier version. Git is the most widely used version control tool.
virtual environment
A private set of Python packages for one project. The `.venv/` folder is listed in `.gitignore`.

W

wc
Counts lines, words and characters. `wc -l` counts only lines.
which and type
`which` shows where a program lives, and `type` tells you what kind of command a name is, such as a shell builtin. Both help answer whether it is a real program.
whoami and date
Two simple first commands: `whoami` prints your user name and `date` prints the current date and time.
wildcard
A character in a name that matches many files: `*` any characters, `?` exactly one and `[ ]` one from a set. The shell expands the pattern into a list of names before the command runs.
working directory
The folder the shell is in right now. Relative paths are read from it, and `pwd` shows it.
working tree
The files you see and edit in a repository's folder. A clean working tree means every file matches the last commit.
WSL
Windows Subsystem for Linux, a Windows feature that runs Linux inside Windows. People who use it work in a Linux shell with Linux commands.

Z

zsh
The usual shell on macOS. It understands the same everyday commands as bash.