Skip to content

Developer Command Reference

Searchable Git, package manager, and Docker commands — 94 to start, with more added over time.

Git

git init

Create a new Git repository in the current directory.

git clone <url>

Copy a remote repository to your machine.

Example: git clone https://github.com/user/repo.git

git config --global user.name "<name>"

Set the name attached to your commits, globally for this machine.

git config --global user.email "<email>"

Set the email attached to your commits, globally for this machine.

git status

Show which files are staged, modified, or untracked.

git add <file>

Stage a file's changes for the next commit.

Example: git add . (stages everything in the current directory)

git commit -m "<message>"

Record staged changes as a new commit.

git log --oneline

Show commit history, one line per commit.

git diff

Show unstaged changes compared to the last commit.

git diff --staged

Show staged changes compared to the last commit.

git branch

List local branches. Add a name to create one: git branch <name>.

git checkout -b <name>

Create a new branch and switch to it in one step.

git switch <branch>

Switch to an existing branch (the modern replacement for git checkout <branch>).

git merge <branch>

Merge another branch into the current one.

git rebase <branch>

Replay the current branch's commits on top of another branch, for a linear history.

git stash

Temporarily shelve uncommitted changes so you can switch branches cleanly.

git stash pop

Re-apply the most recently stashed changes and remove them from the stash.

git remote add origin <url>

Connect a local repository to a remote one for the first time.

git pull

Fetch and merge changes from the remote branch you're tracking.

git push

Upload local commits to the remote branch you're tracking.

git push -u origin <branch>

Push a new branch and set it to track the matching remote branch.

git reset --soft HEAD~1

Undo the last commit, keeping its changes staged.

git reset --hard HEAD~1

Undo the last commit and discard its changes entirely. Destructive — the changes are not recoverable through normal means.

git revert <commit>

Create a new commit that undoes a previous one, without rewriting history — the safe way to undo a commit that's already been pushed.

git cherry-pick <commit>

Apply a specific commit from another branch onto the current one.

git tag <name>

Mark the current commit with a named tag, commonly used for releases.

git fetch

Download remote changes without merging them into your working branch.

git clean -fd

Remove untracked files and directories from the working tree. Destructive and not undoable — review with git clean -nd first.

git log --oneline --graph --all

Show a visual graph of all branches and their commit history.

git blame <file>

Show who last modified each line of a file, and in which commit.

git worktree add <path> <branch>

Check out another branch into a separate working directory, without switching the current one.

git bisect start

Binary-search commit history to find which commit introduced a bug. Follow with git bisect bad / git bisect good.

git reflog

Show a log of everywhere HEAD has pointed — useful for recovering commits that seem lost after a reset.

git commit --amend

Rewrite the most recent commit (message and/or staged changes). Avoid on commits already pushed and shared.

git rebase -i HEAD~<n>

Interactively edit, squash, or reorder the last n commits before they're shared.

git diff <branch1>..<branch2>

Show the differences between two branches.

git show <commit>

Show the full details (metadata and diff) of a single commit.

NPM & Yarn

npm init -y

Create a new package.json with default values.

npm install

Install all dependencies listed in package.json.

npm install <package>

Add a package as a dependency and install it.

npm install -D <package>

Add a package as a dev-only dependency.

npm run <script>

Run a script defined in package.json's "scripts" field.

npm ci

Install dependencies exactly as locked in package-lock.json — faster and stricter than npm install, intended for CI.

npm outdated

List installed packages that have a newer version available.

npm uninstall <package>

Remove a package and its entry from package.json.

yarn add <package>

Add a package as a dependency (Yarn's equivalent of npm install <package>).

yarn add -D <package>

Add a package as a dev-only dependency.

yarn dev

Common convention for running a project's dev server script — check package.json's "scripts" for the actual command.

npx <package>

Run a package's binary without installing it globally — downloads and runs it once.

pnpm install

Install dependencies with pnpm — faster and more disk-efficient than npm via a shared content-addressable store.

pnpm add <package>

Add a package as a dependency with pnpm.

npm list --depth=0

List top-level installed dependencies and their resolved versions.

npm audit

Check installed dependencies for known security vulnerabilities.

Docker

docker build -t <name> .

Build an image from a Dockerfile in the current directory.

docker run -p 8080:80 <image>

Start a container from an image, mapping a host port to a container port.

docker ps

List running containers. Add -a to include stopped ones.

docker logs -f <container>

Stream a running container's logs.

docker exec -it <container> sh

Open an interactive shell inside a running container.

docker compose up -d

Start all services defined in docker-compose.yml in the background.

docker compose down

Stop and remove containers, networks, and volumes created by docker compose up.

docker image prune

Remove unused (dangling) images to free up disk space.

docker stop <container>

Gracefully stop a running container.

docker rm <container>

Remove a stopped container. Add -f to force-remove a running one.

docker images

List locally stored images.

docker pull <image>

Download an image from a registry without running it.

docker system prune -a

Remove all unused containers, networks, and images to reclaim disk space. Only removes stopped/unused resources.

Package Managers

composer install

Install PHP dependencies exactly as locked in composer.lock.

composer require <package>

Add a PHP package as a dependency and install it.

composer create-project laravel/laravel <name>

Scaffold a new Laravel project.

pip install <package>

Install a Python package into the current environment.

pip freeze > requirements.txt

Write all installed package versions to a requirements file.

pip install -r requirements.txt

Install every package listed in a requirements file.

python -m venv .venv

Create an isolated Python virtual environment in .venv.

source .venv/bin/activate

Activate a virtual environment (macOS/Linux). On Windows: .venv\Scripts\activate.

Linux & Shell

ls -la

List all files in the current directory, including hidden ones, with details.

cd <path>

Change the current directory. cd .. goes up one level; cd ~ goes to home.

pwd

Print the current working directory's full path.

mkdir -p <path>

Create a directory, including any missing parent directories.

rm -rf <path>

Remove a file or directory recursively and without confirmation. Destructive and not undoable — double-check the path first.

cp -r <src> <dest>

Copy a file or directory (recursively for directories).

mv <src> <dest>

Move or rename a file or directory.

chmod +x <file>

Make a file executable. Use chmod 644/755 for explicit numeric permissions.

grep -rn "<pattern>" .

Recursively search files in the current directory for a pattern, showing line numbers.

find . -name "<pattern>"

Search the current directory tree for files matching a name pattern.

curl -s <url>

Fetch a URL's response body silently. Add -I for headers only, -X POST for a POST request.

ssh <user>@<host>

Open a secure shell session on a remote machine.

scp <file> <user>@<host>:<path>

Copy a file to a remote machine over SSH.

tar -czvf <archive>.tar.gz <dir>

Create a compressed tar archive of a directory.

tar -xzvf <archive>.tar.gz

Extract a gzip-compressed tar archive.

ps aux | grep <name>

List running processes and filter by name.

kill -9 <pid>

Force-terminate a process by its process ID.

lsof -i :<port>

Show which process is listening on a given port.

export <VAR>=<value>

Set an environment variable for the current shell session and any child processes.

which <command>

Show the full path of the executable that would run for a given command name.

This is a starting reference, not an exhaustive command library — command behavior can vary by version and platform.