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

Synopsis

git log [<options>] [<revision-range>] [[--] <path>...]

Description

The git log command displays the commit history reachable from one or more refs (defaulting to HEAD). It is one of the most flexible tools in Git, supporting filtering by author, date, message content, file paths, and more. Combined with formatting options, it can produce output suitable for changelogs, audits, and code archaeology.

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

Synopsis

git ls-remote [--heads] [--tags] [<repository> [<refs>...]]

Description

The git ls-remote command queries a remote (without cloning or fetching) and prints the SHA-1 of each ref alongside the ref name. It is invaluable for scripting, CI pipelines, and quick inspection — for example, finding the latest tag on a remote or checking whether a branch exists. Because it does not download objects, it's lightweight and fast even against very large repositories.

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

Synopsis

git push [<remote> [<refspec>...]] [--force-with-lease] [--tags] [--delete]

Description

The git push command sends local commits to a remote repository, updating remote branches to match your local ones. The first push of a new branch typically requires -u to set up tracking. By default, push is non-destructive: it refuses to overwrite remote history that you don't have locally.

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

Synopsis

git pull [--rebase] [--ff-only] [<remote> [<branch>]]

Description

The git pull command is shorthand for git fetch followed by an integration step (merge by default, rebase optionally). It updates your current branch to incorporate upstream changes. Many teams prefer to configure pull.rebase = true or use git pull --rebase to keep history linear.

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

Synopsis

git fetch [<options>] [<remote> [<refspec>...]]

Description

The git fetch command downloads new commits, files, and refs from a remote repository into your local repo, but does NOT merge them into your working branch. After fetching, the remote-tracking refs (like origin/main) are updated, and you can inspect what's new with git log origin/main before deciding to merge or rebase.

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

Synopsis

git remote [-v]
git remote add <name> <url>
git remote remove <name>
git remote set-url <name> <url>

Description

The git remote command manages the set of repositories ("remotes") whose URLs are stored in your local config. Each remote has a short nickname (commonly origin for the original clone source and upstream for the project you forked from). When you run git fetch origin, git push origin, or similar, the nickname is resolved to the URL.

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

Synopsis

git mergetool [-t <tool>] [--tool-help] [<file>...]

Description

The git mergetool command launches an external merge tool to help resolve conflicts after a merge, rebase, or cherry-pick stops with conflicts. Common tools include vimdiff, meld, kdiff3, p4merge, opendiff, and vscode.

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

Synopsis

git rebase [-i] [--onto <newbase>] [<upstream> [<branch>]]

Description

The git rebase command moves a sequence of commits to a new base. It rewrites history by replaying each commit on top of the new base, producing a linear chain rather than a merge commit. Rebasing is invaluable for keeping feature branches up to date, cleaning up local history before pushing, and squashing fixup commits.

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

Synopsis

git merge [--no-ff] [--squash] [--abort] [-s <strategy>] [<branch>]

Description

The git merge command integrates changes from one branch into another. By default it produces a "true merge" commit with two parents, preserving the topology of both histories. If the target branch is a strict ancestor of the source, Git fast-forwards by simply moving the branch pointer; pass --no-ff to always record a merge commit.

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

Synopsis

git switch [-c <new-branch>] [--detach] <branch>

Description

The git switch command, introduced in Git 2.23, is a focused replacement for the branch-switching half of git checkout. It only switches branches (or creates and switches in one step). It refuses to operate on individual files, eliminating the most common source of checkout footguns. If you're learning Git today, prefer git switch for branches and git restore for files.