This page helps you to view a diff for a given commit hash. Useful when you want to see specific commits and want to extract and generate a diff in case you lost the commit.
Source: Git – how to view diff for a given commit id – InfoHeap
This page helps you to view a diff for a given commit hash. Useful when you want to see specific commits and want to extract and generate a diff in case you lost the commit.
Source: Git – how to view diff for a given commit id – InfoHeap
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
git diff “0c92a659288e78cd277acd57ec5bdb8aec37464e^” 0c92a659288e78cd277acd57ec5bdb8aec37464e > changes.patch
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
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…:-)
Nice article which guides you well through the fundamentals of Git.
Source: Git How To: Guided Git Tutorial
“The latest feature release GIT 1.6.0 is available at the usual places,” began Git maintainer, Junio Hamano, announcing the latest stable release of the distributed version control system originally written by Linus Torvalds.
Following lots of useful discussion and evaluation of the available DVCSs out there, the GHC team have made a decision: we’re going to switch to git.
Rietveld is the code review tool that Guido wrote as an App Engine demo.
Blogged with Flock