mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 15:18:01 +00:00
14 lines
312 B
Markdown
14 lines
312 B
Markdown
# What Is The Current Branch?
|
|
|
|
This question can be answered with one of git's plumbing commands,
|
|
`rev-parse`.
|
|
|
|
```
|
|
$ git rev-parse --abbrev-ref HEAD
|
|
```
|
|
|
|
The `--abbrev-ref` flag tells `git-rev-parse` to give us the short name for
|
|
`HEAD` instead of the SHA.
|
|
|
|
[source](http://stackoverflow.com/a/12142066/535590)
|