Git Essential Commands

Common Git commands for everyday version control workflows.

  • JSON7,820 B
  • YAML5,539 B · −29%
  • TOON4,440 B · −43%

Essential git commands with a one-line description: init, clone, add, commit, push, pull, branch, checkout, merge, rebase, stash, log, diff, reset and cherry-pick, extended with status, fetch, restore, switch, tag, blame, bisect, revert, reflog, worktrees and configuration.

Use it when

  • You need the right git command for a task.
  • You are teaching or learning git from the command line.

Watch out for

  • Some commands rewrite history (rebase, reset --hard, commit --amend); do not use them on commits others have pulled.
  • Newer commands (switch, restore) are clearer than checkout and reset for those tasks.

The data

CommandDescription
git initInitialize a new Git repository in the current directory.
git clone <url>Clone a remote repository to your local machine.
git add <file>Stage changes for the next commit. Use git add . for all.
git commit -m "msg"Commit staged changes with a descriptive message.
git pushUpload local commits to the remote repository.
git pullFetch and merge changes from the remote branch.
git branch -aList all local and remote branches.
git checkout <branch>Switch to the specified branch. Use -b to create and switch.
git merge <branch>Merge the specified branch into the current branch.
git rebase <branch>Reapply commits on top of another branch. Use with caution on public branches.
git stashTemporarily store uncommitted changes. Use git stash pop to restore.
git log --oneline -10Show the last 10 commits in compact format.
git diffShow unstaged changes. Use git diff --staged for staged changes.
git reset --soft HEAD~1Undo the last commit, keeping changes staged.
git cherry-pick <hash>Apply a specific commit by hash onto the current branch.
git statusShow changed, staged and untracked files.
git fetchDownload remote changes without merging them.
git restore <file>Discard working-tree changes to a file; use --staged to unstage.
git switch -c <branch>Create a new branch and switch to it.
git diff --stagedShow changes that are staged for the next commit.
git commit --amendModify the most recent commit; avoid after pushing.
git stash popReapply the most recent stash and remove it from the stash list.
git revert <hash>Create a new commit that undoes an earlier one without rewriting history.
git log --graph --oneline --allShow a compact graph of all branches.
git blame <file>Show who last changed each line of a file.
git bisect startBegin a binary search through history to find the commit that introduced a bug.
git tag -a v1.0 -m "msg"Create an annotated tag for a release.
git reflogList where HEAD has been, useful for recovering lost commits.
git branch -d <branch>Delete a branch that has been merged.
git remote -vList remotes and their URLs.
git worktree add <path> <branch>Check out another branch in a separate directory.
git config --global user.name "Name"Set the author name used for commits.
git restore --staged -- pathUnstage a path while retaining its working-tree contents. Add -- before a path that could be read as an option.
git diff --checkFind conflict markers and whitespace errors in the current diff before committing.
git log --all -- pathInspect commits touching a path across all refs, without changing files.
git stash show -p stash@{0}Inspect the latest stash patch before deciding whether to apply it.

Fields

The shape of this dataset, read from the data itself: every column, its type and a real value. Agents can use this to plan a query without fetching the whole document.

SectionFieldTypeExample
datacommandstringgit init
datadescriptionstringInitialize a new Git repository in the current …

Fetch the same bytes

The static files contain the same reference rows as the API, with no API rate limit. Live metadata, such as view counts, may differ. Use the API for content negotiation; use the static files for a cacheable snapshot.

curl "https://yjtoon.yunusemrevurgun.com/api/dataset/git-essential-commands?format=toon"
const res = await fetch(
  "https://yjtoon.yunusemrevurgun.com/static-data/dataset/git-essential-commands.toon"
);
const toon = await res.text();

Rate limit: 120 requests per minute per IP, no key and no signup. API reference →

Sources and editorial notes

Original editorial reference notes by YJTOON, informed by the linked primary documentation. External specifications retain their own licenses.

Editorial review: . Source documents keep their own licenses.

Topics

  • unix
  • git
  • version-control
  • vcs

Search the library

Search by a topic, title, or keyword.

Start with a collection

Browse all 205 datasets