> For the complete documentation index, see [llms.txt](https://protocols.vladimir-vinarsky.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://protocols.vladimir-vinarsky.me/bash/readme.md).

# git shortcuts

## Save the last commit hash to the variable

```
last=$(git log --oneline | head -n 1 | cut -d " " -f1)
```

## Save the last 10 commit hashes to an array

```
last10=($(git log --oneline | head -n 10 | cut -d " " -f1))
```

## Show the dates of commits

```
git show -s --format=%ci <commit-hash>
```

{% tabs %}
{% tab title="Second Tab" %}

```
git show -s --format=%ci ${last10[@]}
```

{% endtab %}
{% endtabs %}
