Git Commit

A commit in Git represents a snapshot of your repository at a given point in time. It includes changes made to files and a commit message describing the changes.

Syntax of git commit command

git commit -m "commit message"

To know more about git commit, check out this article.

How To Revert A Commit With Git Revert?

Git is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers who are collaboratively developing source code during software development. It is free, open-source, and used by almost 95% of developers across the world. There are many popular offerings of Git repository services, including GitHub, Bitbucket, etc.

Similar Reads

Git Commit

A commit in Git represents a snapshot of your repository at a given point in time. It includes changes made to files and a commit message describing the changes....

Git Revert

It might happen that we make some changes and then make a commit but later we discover a bug and we want to undo those changes and restore the project state to the previous commit so it does not create problems for others and people can work smoothly on the project. The git revert command helps us to do that....

Points To Remember

When we do a git revert it does not delete the reverted commit from the commit history instead it stages the changes for another commit with the reverted changes. When you revert a commit c then all the commits made after c will also get reverted....

What is the difference between git revert and git reset?

...

Steps To Revert A Commit

Step 1: In git, every commit is uniquely identifiable by its commit hash. To revert a commit we must know its hash....

Flags (options that can be used with git revert)

1. no-commit : Since the git revert command adds a new commit by default. This flag to applies the revert to your working directory and staging area but doesn’t create a new commit. It allows you to make further modifications or additions before committing the reversion....

Example:

Let’s say we have a git repository called ‘GFG’. It is currently empty. Let’s create a new text file named ‘intro.txt’ and then make a git commit....

Reverting A Commit With Git Revert – FAQ’s

Does git revert delete the original commit?...