Skip to content

[Edit] Git: git log --oneline #6667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
23 changes: 23 additions & 0 deletions content/git/concepts/log/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,26 @@ Date: Mon May 22 14:21:03 2023 -0400.
```

The example log above shows the different elements that make up a commit, but the most useful is the git hash (f5b5bd8f9eaa443d4020cbe918x742e7ddd22000), which can be used to revert our commit changes using the git revert command.

There are various ways to customize the information presented by `git log` using options.

## git log --oneline

The `--oneline` option gives the single commit that is supplied just on one line. Every commit includes a seven-digit SHA number and a commit message.

```shell
$ git log --oneline

9a4223b (HEAD -> chapter_1) added the first paragraph
0a10c27 fixed the spacing issue
18d040d added the second paragraph
```
Using `--online` along with the `--graph` significantly increases the readability of the git log.

```shell
$ git log --oneline --graph

* 9a4223b (HEAD -> chapter_1) added the first paragraph
* 0a10c27 fixed the spacing issue
* 18d040d added the second paragraph
```