git show bbb738746b14e8e4ac09a443e9ac1c931ad61d07
Show details of a commit SHA along with diff
commit bbb738746b14e8e4ac09a443e9ac1c931ad61d07 Author: Nitin Nizhawan <abc@example.com> Date: Sat Feb 27 21:00:29 2016 +0530 Commit A diff --git a/testfile.txt b/testfile.txt new file mode 100644 index 0000000..557db03 --- /dev/null +++ b/testfile.txt @@ -0,0 +1 @@ +Hello World
git show bbb738
Show details of a abbreviated commit SHA along with diff
commit bbb738746b14e8e4ac09a443e9ac1c931ad61d07 Author: Nitin Nizhawan <abc@example.com> Date: Sat Feb 27 21:00:29 2016 +0530 Commit A diff --git a/testfile.txt b/testfile.txt new file mode 100644 index 0000000..557db03 --- /dev/null +++ b/testfile.txt @@ -0,0 +1 @@ +Hello World
git show master
Show commit details along with diff pointed to by a ref
commit bbb738746b14e8e4ac09a443e9ac1c931ad61d07 Author: Nitin Nizhawan <abc@example.com> Date: Sat Feb 27 21:00:29 2016 +0530 Commit A diff --git a/testfile.txt b/testfile.txt new file mode 100644 index 0000000..557db03 --- /dev/null +++ b/testfile.txt @@ -0,0 +1 @@ +Hello World
git show HEAD@{7}
Show details of a commit along with diff pointed to by a reference in reflog
commit bbb738746b14e8e4ac09a443e9ac1c931ad61d07 Author: Nitin Nizhawan <abc@example.com> Date: Sat Feb 27 21:00:29 2016 +0530 Commit A diff --git a/testfile.txt b/testfile.txt new file mode 100644 index 0000000..557db03 --- /dev/null +++ b/testfile.txt @@ -0,0 +1 @@ +Hello World
git show master@{3.hour.41.minute.ago}
Show details of a commit where master was 3 hour 41 minutes ago. Other examples include ref@{yesterday}
commit f46d0d9949274bba7f797a5b63bc004f291905b4 Author: Nitin NizhawanDate: Sat Feb 27 21:01:03 2016 +0530 Commit B diff --git a/testfile.txt b/testfile.txt index 557db03..bc1c618 100644 --- a/testfile.txt +++ b/testfile.txt @@ -1 +1,2 @@ Hello World +ABC
git show --oneline HEAD^2~1
Show commit pointed to by parent reference
$$ git log --graph --pretty=oneline --abbrev-commit * 72cdd46 Merge branch 'testBranch' |\ | * cb2e193 TestBranchB | * ac4148c Commit TestBranchA * | 20e9855 Commit E * | af7725c Commit D |/ * 662b3ca Commit C * f46d0d9 Commit B * bbb7387 Commit A $$ git show --oneline HEAD^2~1 ac4148c Commit TestBranchA diff --git a/testfile.txt b/testfile.txt index 0685a0a..965369c 100644 --- a/testfile.txt +++ b/testfile.txt @@ -1,2 +1,2 @@ Hello World -ABCAA +ABCAADGHL $$ git show --oneline HEAD^1~1 af7725c Commit D diff --git a/testfile.txt b/testfile.txt index 0685a0a..6a31125 100644 --- a/testfile.txt +++ b/testfile.txt @@ -1,2 +1,2 @@ Hello World -ABCAA +ABCAAAAAAA