From 5639f48a32b0b25bf89708e9d1ffdefbc017182d Mon Sep 17 00:00:00 2001 From: laurentheirendt <laurent.heirendt@uni.lu> Date: Mon, 23 Sep 2019 08:43:02 +0200 Subject: [PATCH] slide for reverting a commit --- .../slides/revert.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/2019/2019-09-24_advancedGitTraining/slides/revert.md b/2019/2019-09-24_advancedGitTraining/slides/revert.md index d0449433..1abc41c9 100644 --- a/2019/2019-09-24_advancedGitTraining/slides/revert.md +++ b/2019/2019-09-24_advancedGitTraining/slides/revert.md @@ -1,22 +1,25 @@ -# 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> ``` -- GitLab