Skip to content
Snippets Groups Projects
Verified Commit 5639f48a authored by Laurent Heirendt's avatar Laurent Heirendt :airplane:
Browse files

slide for reverting a commit

parent e90b37ac
No related branches found
No related tags found
No related merge requests found
# Theory: Git Revert
# Reverting a commit
* Enables the deletion of committed commits
* Enables the deletion of committed commits by reverting the changes.
* A trace is kept in history of the original commit and the reverted one.
# Practical: Git Revert
# Example:
* On your branch, create and commit a file:
```bash
$ echo "# This commits contains errors" > revert.txt
$ git add revert.txt
$ git commit -m "Error"
$ cd attendees
$ echo "# Grades for Firstname Lastname" > grades.md
$ git add grades.md
$ git commit -m "File with grades for Firstname Lastname"
```
* check the commit log and copy the `Error` commit ID:
* check the commit log and copy the SHA1:
```bash
$ git log
```
* Use the 'git revert' command to undo this selected commit:
* Use the `git revert` command to undo this selected commit:
```bash
$ git revert <sha1>
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment