[Git]: log
git
09/24/2019
BASH
$ git log
- Lists the commits made in the repo in reverse chronological order
- -4 flag shows 4 most recent commits
- Output:
TEXT
$ git log -4commit f9089e71kdiendjef437d2948200bfaf86e00ce4 (HEAD -> master, origin/master)Author: Ellis MinDate: Tue Sep 24 15:23:21 2019 -0500
modified post
commit 1a918ba16oriejc01ea3353c68b81a420b42d039Author: Ellis MinDate: Tue Sep 24 15:18:16 2019 -0500
modified post
commit ppe31720765e33cdec6c3f50c16b662f51eb29c1Author: Ellis MinDate: Tue Sep 24 15:16:33 2019 -0500
modified post
commit db020060bad7ebf2e286d2a52574f055fd27b454Author: Ellis MinDate: Tue Sep 24 15:13:57 2019 -0500
modified post: <!-- press q to quit -->
BASH
$ git log -p
- Displays the differences (-p for -patch)
- Output:
TEXT
$ git log -p -1commit f9089e719eac344ef437d2948200bfaf86e00ce4 (HEAD -> master, origin/master)Author: Ellis MinDate: Tue Sep 24 15:23:21 2019 -0500
modified post
diff --git a/_posts/2019-04-15-sample_post.md b/_posts/2019-04-15-sample_post.mdindex adfc823..59caefb 100644--- a/_posts/2019-04-15-sample_post.md+++ b/_posts/2019-04-15-sample_post.md@@ -1,7 +1,7 @@ --- title: "Sample Post" date: 2019-04-15-tags:+tags: [Markdown] header: image: excerpt: "My first post"@@ -79,4 +79,21 @@ line breaks Using pre tag within div container.-</div>\ No newline at end of file+</div>++### Similar code snippets for shell/bash++* shell+```shell+$ git log --pretty=format:"%h - %an, %ar : %s"+```++* +```+$ git log --pretty=format:"%h - %an, %ar : %s"+```++* bash+```bash+$ git log --pretty=format:"%h - %an, %ar : %s"+```\ No newline at end of file
BASH
$ git log --stat
- Shows abbreviated stats for each commit
- Output:
TEXT
$ git log --stat -2commit 8291cfac2c051fe857dfadcd44a19eb7820d94ba (HEAD -> master, origin/master)Author: Ellis Min <[email protected]>Date: Tue Sep 24 15:53:07 2019 -0500
modified post
_posts/2019-09-25-gitlog.md | 85 ++++----------------------------------------- 1 file changed, 6 insertions(+), 79 deletions(-)
commit 4667df2269ff2adcaf0943f35882a8b5b3f918d9Author: Ellis Min <[email protected]>Date: Tue Sep 24 15:51:16 2019 -0500
modified post
_posts/2019-09-25-gitlog.md | 2 -- _posts/2019-09-25-stringfunc.md | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-)
BASH
$ git log --pretty=format:"%h - %an, %ar : %s"
- --pretty tag changes log output to differnet formats
- Output:
TEXT
$ git log --pretty=format:"%h - %an, %ar : %s" -3753f534 - Ellis Min, 2 minutes ago : modified poste54279b - Ellis Min, 4 minutes ago : modified post8291cfa - Ellis Min, 10 minutes ago : modified post
BASH
$ git log --oneline -4
- Prints last 4 commits on a single line
- same as:
BASH
$ git log --pretty=oneline -4
- Output:
TEXT
$ git log --oneline -4753f534 (HEAD -> master, origin/master) modified poste54279b modified post8291cfa modified post4667df2 modified post