Blog/content/posts/2022/git/get-commit-hash.md
2022-11-19 03:36:06 +03:00

23 lines
623 B
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "#⃣ Git: Получить хэш коммита"
date: 2022-09-19T22:28:56+03:00
draft: false
tags: [tips, git]
---
### rev-parse
Команда `git rev-parse` возвращает хеш коммита для указанной ревизии.
Полное описание доступно на [git-scm.com](https://git-scm.com/docs/git-rev-parse).
Команда ниже вернёт хэш текущего коммита (**HEAD**).
```sh
git rev-parse HEAD
```
А с параметром `--short` команда вернёт короткий хэш 😀.
```sh
git rev-parse --short HEAD
```