git revert HEAD
Reverts the most recent commit
This command undoes the changes made in the most recent commit by creating a new commit that contains the opposite changes. It is useful for undoing erroneous commits or reverting the effects of a previous commit.
By default, git revert
undoes the most recent commit specified by HEAD
, but you can also specify a different commit to be reverted using its commit hash. It creates a new commit that undoes the changes made in the specified commit. Various flags can be used with this command to modify its behavior, such as --no-edit
to suppress the default commit message prompt, --no-commit
to only apply the changes without creating a new commit, or --mainline <parent-number>
to revert a merge commit by specifying the parent number.
Sign in to enable bookmarking, reminders, progress-tracking and more...
Related