mirror of
https://github.com/jbranchaud/til
synced 2026-01-04 23:58:01 +00:00
Add What Is The Current Branch as a git til.
This commit is contained in:
@@ -84,6 +84,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
||||
- [Stashing Untracked Files](git/stashing-untracked-files.md)
|
||||
- [Untrack A File Without Deleting It](git/untrack-a-file-without-deleting-it.md)
|
||||
- [Verbose Commit Message](git/verbose-commit-message.md)
|
||||
- [What Is The Current Branch](git/what-is-the-current-branch.md)
|
||||
- [Whitespace Warnings](git/whitespace-warnings.md)
|
||||
|
||||
### go
|
||||
|
||||
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