LinuxCommandLibrary

git-revert

Create commits that undo previous changes

TLDR

Revert a commit

$ git revert [commit]
copy
Revert multiple commits
$ git revert [commit1] [commit2]
copy
Revert without committing
$ git revert -n [commit]
copy
Revert merge commit
$ git revert -m [1] [merge_commit]
copy
Continue after conflict
$ git revert --continue
copy
Abort revert
$ git revert --abort
copy

SYNOPSIS

git revert [options] commit...

DESCRIPTION

git revert creates new commits that undo the changes introduced by specified commits. Unlike `git reset`, it preserves history by adding inverse commits rather than removing existing ones.
This makes it safe for shared branches where rewriting history would cause problems. Use `-m` to specify the mainline parent when reverting merge commits.

PARAMETERS

-n, --no-commit

Don't auto-commit.
-e, --edit
Edit commit message.
--no-edit
Use default message.
-m parent
Mainline parent for merge.
--continue
Continue after conflict.
--abort
Cancel revert.
--skip
Skip current commit.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community