Skip to content

Commit cb81c75

Browse files
committed
added git show and log info
1 parent 541a8cb commit cb81c75

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

git-commands.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ a Git repository with tracked files and an initial commit.
4141
`git status` displays information such as which files are in which states.
4242

4343
## git log
44-
44+
4545
`git log` displays information about existing commits.
4646
Output uses `less` bash command to display one page at a time.
4747
a colon `:` at the bottom left means there is more to display. You can navigate
@@ -56,6 +56,8 @@ By default, this command displays:
5656
Git displays because the git log command can display a lot more information
5757
than just this.
5858

59+
You can specify a SHA (or just the first 7 digits of it) as the final argument to `git log` with any of the other options below to see only that one commits info. Like this: `git log -p fdf5493`
60+
5961
`git log --oneline` will display just the first 7 digits of the SHA and the commits message on one line.
6062

6163
`git log --stat` displays the files that have been changed in a commit and the number of lines that have been added or deleted.
@@ -76,5 +78,17 @@ the `-` indicates the original file and `+` indicates the new changed file.
7678

7779
## git show
7880

79-
`git show` // displays information about the given commit by appending
80-
it's sha hash.
81+
`git show` displays information about the given commit by appending
82+
it's SHA like this: `git show fdf5493`.
83+
84+
By default it shows:
85+
- the commit
86+
- the author
87+
- the date
88+
- the commit message
89+
- the patch information
90+
91+
However, `git show` can be combined with most of the same flags as for `git log`:
92+
- `--stat` to show the how many files were changed and the number of lines that were added/removed.
93+
- `-p` or `--patch` this the default, but if `--stat` is used, the patch won't display, so pass `-p` to add it again.
94+
- `-w` to ignore changes to whitespace.

0 commit comments

Comments
 (0)