User Tools

Site Tools


git_revert

This is an old revision of the document!


Overview

How to revert one or more commits, dealing with any possible merge conflicts along the way.

SYNOPSIS

git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...
git revert --continue
git revert --quit
git revert --abort

The variations

Reverting a single commit

How:

$ git revert 2965b41

which throws you into a commit edit session:

Revert "HTTP->HTTPS"

This reverts commit 2965b41fd84a1a76f56984ecdf6c123d1992730f.
... snip ...

The default is --edit if done from a terminal; you can override with --no-edit.

Reverting a range of commits

Revert commits individually:

$ git revert v1.0 v1.1

Revert commits in one operation but do not commit so you can tweak further:

$ git revert -n v1.0 v1.1
git_revert.1552471242.txt.gz · Last modified: 2019/03/13 10:00 by rpjday