Skip to content

Commit

Permalink
added git show and log info
Browse files Browse the repository at this point in the history
  • Loading branch information
G1enB1and committed Dec 21, 2017
1 parent 541a8cb commit cb81c75
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions git-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ a Git repository with tracked files and an initial commit.
`git status` displays information such as which files are in which states.

## git log

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

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`

`git log --oneline` will display just the first 7 digits of the SHA and the commits message on one line.

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

## git show

`git show` // displays information about the given commit by appending
it's sha hash.
`git show` displays information about the given commit by appending
it's SHA like this: `git show fdf5493`.

By default it shows:
- the commit
- the author
- the date
- the commit message
- the patch information

However, `git show` can be combined with most of the same flags as for `git log`:
- `--stat` to show the how many files were changed and the number of lines that were added/removed.
- `-p` or `--patch` this the default, but if `--stat` is used, the patch won't display, so pass `-p` to add it again.
- `-w` to ignore changes to whitespace.

0 comments on commit cb81c75

Please sign in to comment.