Par Anonyme (non vérifié) , 29 avril 2026

Synopsis

git clean [-d] [-f] [-x | -X] [-n] [-i] [<path>...]

Description

The git clean command removes untracked files from the working tree. By default it requires -f (or clean.requireForce = false) as a safety measure because deletions are irreversible. With -d it also removes untracked directories, and -x additionally removes files that are normally ignored (build outputs, dependency caches).

Par Anonyme (non vérifié) , 29 avril 2026

Synopsis

git revert [-n] [-m <parent>] <commit>...

Description

The git revert command creates a new commit whose changes are the inverse of an earlier commit's. Unlike git reset, it doesn't rewrite history — it adds a new commit that undoes one or more old ones. This makes revert safe to use on shared branches: collaborators see a clear "undo" commit rather than rewritten history.

Par Anonyme (non vérifié) , 29 avril 2026

Synopsis

git reset [--soft | --mixed | --hard] [<commit>]
git reset [<commit>] [--] <pathspec>...

Description

The git reset command moves the current branch pointer to a specified commit, optionally updating the index and working tree. It has three primary modes: --soft (move HEAD only), --mixed (default; also reset the index), and --hard (also reset the working tree, discarding all changes).

Par Anonyme (non vérifié) , 29 avril 2026

Synopsis

git restore [--staged] [--source=<tree>] [-p] <pathspec>...

Description

The git restore command, introduced in Git 2.23, replaces the file-restoring half of git checkout. It is purpose-built for two cases: discarding unstaged changes in the working tree (default behavior) and unstaging changes from the index (with --staged). The cleaner separation makes the tool less error-prone than git checkout.

Par Anonyme (non vérifié) , 29 avril 2026

Synopsis

git describe [--tags] [--always] [--dirty] [<commit>]

Description

The git describe command produces a human-readable name for a commit based on the most recent reachable tag. The output looks like v1.4.2-13-gabc1234, meaning "13 commits past tag v1.4.2, at SHA abc1234." If the commit is exactly at a tag, only the tag name is printed.

Par Anonyme (non vérifié) , 29 avril 2026

Synopsis

git shortlog [-n] [-s] [-e] [<revision-range>]

Description

The git shortlog command groups commits by author, producing concise summaries suitable for release notes, contributor lists, and quick "who did what" overviews. By default it prints each author's name followed by the subject lines of their commits in the given range.

Par Anonyme (non vérifié) , 29 avril 2026

Synopsis

git grep [<options>] <pattern> [<tree-ish>...]

Description

The git grep command searches files tracked by Git for a pattern. It is much faster than grep -r on large repositories because it only searches what Git knows about (skipping .git, build outputs, and ignored files) and uses Git's optimized object database. You can also search any historical revision or tree, not just the working copy.

Par Anonyme (non vérifié) , 29 avril 2026

Synopsis

git bisect start
git bisect good <commit>
git bisect bad <commit>
git bisect run <script>
git bisect reset

Description

The git bisect command performs a binary search through commit history to identify exactly which commit introduced a bug. You start by marking a known-bad commit (often HEAD) and a known-good commit (perhaps a release tag), then Git checks out a midpoint and asks you to test. You answer "good" or "bad," Git narrows the range, and you repeat until the offending commit is found.

Par Anonyme (non vérifié) , 29 avril 2026

Synopsis

git blame [-L <range>] [-w] [-M] [-C] <file>

Description

The git blame command annotates each line of a file with the commit, author, and timestamp that last touched it. It is invaluable for understanding why a piece of code looks the way it does, who introduced it, and when. Despite the accusatory name, blame is mostly used as a research tool, not as a means of finger-pointing.

Par Anonyme (non vérifié) , 29 avril 2026

Synopsis

git show [<options>] [<object>...]

Description

The git show command displays information about Git objects: commits (with diff), tags (annotation + tagged object), trees (file listing), or blobs (file contents). Without arguments, it shows the most recent commit. With a path argument, it displays the file as it existed at a specific revision.