Tutorial: How to revert your git commit

This example shows how to revert your git commit.

As an example I have modified README.md file in my website

C:\code\smccake\smccake>git diff
diff --git a/README.md b/README.md
index 44ea578..58e71fc 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
-# smccake
+# smccake test
St. Marys church Cake Project

Committed the code with “git commit command”

C:\code\smccake\smccake>git commit -m "test commit" -a
[main 0c92a65] test commit
 1 file changed, 1 insertion(+), 1 deletion(-)

C:\code\smccake\smccake>git log
commit 0c92a659288e78cd277acd57ec5bdb8aec37464e (HEAD -> main)
Author: Yogindar <yogindar@yahoo.com>
Date:   Thu Feb 3 16:12:41 2022 +0530

    test commit

Note the commit hash id 0c92a659288e78cd277acd57ec5bdb8aec37464e. This is what we used to refer back our commits.

Now we wanted to revert the commit, we can use the “git revert” command with the commit hash.

C:\code\smccake\smccake>git revert 0c92a659288e78cd277acd57ec5bdb8aec37464e
[main 5c26ac1] Revert “test commit”
1 file changed, 1 insertion(+), 1 deletion(-)

You can do a “git push”

I’m going to give you another extra lecture on how to add the reverted changes back.

So we know the commit hash, now generate the diff again using the commit hash.

Create a patch with the diff and apply it.

C:\code\smccake\smccake>git diff “0c92a659288e78cd277acd57ec5bdb8aec37464e^” 0c92a659288e78cd277acd57ec5bdb8aec37464e
diff –git a/README.md b/README.md
index 44ea578..58e71fc 100644
— a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
-# smccake
+# smccake test
St. Marys church Cake Project

git diff “0c92a659288e78cd277acd57ec5bdb8aec37464e^” 0c92a659288e78cd277acd57ec5bdb8aec37464e > changes.patch

C:\code\smccake\smccake>git apply changes.patch

C:\code\smccake\smccake>git diff
diff –git a/README.md b/README.md
index 44ea578..58e71fc 100644
— a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
-# smccake
+# smccake test
St. Marys church Cake Project

Happy giting…:-)

Machine Owner Key (MOK) – Understanding the UEFI Secure Boot Chain

MOK Architecture. The keys added via mokutil via any Linux OS, will be stored in the MOK database. Since its a boot service variable, it will be stored in the BIOS NVRAM. On next boot the shim layer will prompt for enrolling the key. Once enrolled the key can be used to validate the respective async drivers (not part of OS distribution) by kernel to allow installing them during OS boot or run time.

Source: Machine Owner Key (MOK) – Understanding the UEFI Secure Boot Chain

Understanding How Facebook Disappeared from the Internet

The Internet is literally a network of networks, and it’s bound together by BGP. BGP allows one network (say Facebook) to advertise its presence to other networks that form the Internet. As we write Facebook is not advertising its presence, ISPs and other networks can’t find Facebook’s network and so it is unavailable.

Source: Understanding How Facebook Disappeared from the Internet