git initStart a Git repository in the current directory.
A task-oriented command reference. Search by command or outcome, then inspect the change before you record or discard it.
Create a local history or obtain an existing one.
git initStart a Git repository in the current directory.
git clone URLCopy a repository, including its history.
hg initStart a Mercurial repository.
svn checkout URLGet a working copy from a Subversion server.
fossil init project.fossilCreate a Fossil repository file.
fossil open project.fossilOpen that repository in the current directory.
See the working tree, staged content, and history.
git status --shortA compact view of changed, staged, and untracked files.
git diffInspect unstaged edits.
git diff --stagedInspect what the next commit would contain.
git log --oneline --graph --decorate -20Read a compact graph of recent commits.
hg statusShow Mercurial working-copy changes.
svn statusShow Subversion working-copy changes.
Make a commit that describes one coherent step.
git add -pChoose individual hunks for the staging area.
git commit -m "Explain the change"Record staged content with a clear message.
hg commit -m "Explain the change"Record a Mercurial changeset.
svn commit -m "Explain the change"Send a Subversion revision to the server.
fossil commit -m "Explain the change"Record a Fossil check-in.
Keep parallel work legible without losing your place.
git switch -c feature/nameCreate and switch to a new Git branch.
git switch mainReturn to the main branch (if it is named main).
git worktree add -b feature/name ../feature mainCreate a second working tree on a new branch.
git merge feature/nameBring another branch into the current one.
hg bookmark featureCreate a movable Mercurial bookmark.
hg update featureUpdate the working directory to that bookmark.
Prefer operations that keep published history intact.
git restore --staged path/to/fileUnstage a file while keeping its working-tree edits.
git restore path/to/fileDiscard local edits to a file. Check the diff first.
git revert COMMITCreate a new commit that reverses a previous commit.
git reflogFind recent positions of local references after a mistake.
git bisect startBegin narrowing down the commit that introduced a bug.
git blame -- path/to/fileSee the last recorded change for each line.
No matching commands. Try a different word.
Before destructive operations: inspect git status and git diff. git restore path/to/file discards uncommitted edits; git revert is usually the safer way to undo a published commit.