mirror of
https://github.com/jbranchaud/til
synced 2026-01-08 01:28:02 +00:00
Add What Is The Current Branch as a git til.
This commit is contained in:
13
git/what-is-the-current-branch.md
Normal file
13
git/what-is-the-current-branch.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# 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)
|
||||
Reference in New Issue
Block a user