Git Command Reference

Curated daily-use Git commands: init, clone, branch, merge, stash, and remotes. Search and copy in one click for beginners and occasional memory lapses.

Privacy: processed locally, never uploaded.

↓ Paste in the input area below to see results instantly

Quick reference for common Git commands; search and copy in one click.

git init

Initialize a new repository

git clone <url>

Clone a remote repository

git status

Show working tree status

git add <file>

Stage changes

git add .

Stage all changes

git commit -m "msg"

Commit staged changes

git push

Push commits to remote

git pull

Fetch and merge remote changes

git branch

List branches

git branch <name>

Create a branch

git checkout <branch>

Switch branch

git switch <branch>

Switch branch (newer)

git merge <branch>

Merge branch into current

git log --oneline

Compact commit history

git diff

Show unstaged diff

git stash

Stash working changes

git stash pop

Apply latest stash

git remote -v

List remotes

git fetch

Download remote objects

git rebase <branch>

Rebase onto branch

Notes

Note

Curated daily-use Git commands; see git help and official docs for full options.

Curated daily-use Git commands: init, clone, branch, merge, stash, and remotes. Search and copy in one click for beginners and occasional memory lapses.

Quick start

  1. Browse list

    Commands ordered by everyday frequency.

  2. Search

    Filter by command name or description.

  3. Copy command

    Paste into your terminal.

vs git help

This is a cheat sheet; run git help <command> for full options and flags.

Typical Workflow

Start by cloning a repo: `git clone <url>` copies the entire remote codebase locally. During daily work, use `git checkout -b feature-x` to isolate changes in a new branch. After completing features, stage changes with `git add .`, commit via `git commit -m "message"`, then push the branch with `git push origin feature-x`.

For urgent bugs, use `git stash` to temporarily save uncommitted changes and clear the workspace before switching to main branch. When merging, `git merge --no-ff` preserves branch history, while conflicts can be resolved visually with `git mergetool`. Regularly run `git fetch --prune` to clean up local refs for deleted remote branches.

Examples

Example

Input

git stash

Output

Stash working changes

FAQ

Advanced commands?

Focuses on daily ops; see official docs for rebase -i, filter-branch, etc.

Needs network?

No. Static reference only.

Why is the .git directory missing after cloning?

You likely used `--depth=1` for shallow clone, which only downloads the latest history to save space. For full history, either reclone without this flag or run `git fetch --unshallow` on the existing repo.