Nest all content into snippets
This commit is contained in:
21
snippets/git/s/current-branch-name.md
Normal file
21
snippets/git/s/current-branch-name.md
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
title: Get the current branch name
|
||||
type: snippet
|
||||
language: git
|
||||
tags: [branch]
|
||||
cover: cherry-trees
|
||||
dateModified: 2021-04-13T21:10:59+03:00
|
||||
---
|
||||
|
||||
Prints the current branch name.
|
||||
|
||||
- Use `git rev-parse --abbrev-ref HEAD` to print the name of the current branch.
|
||||
|
||||
```shell
|
||||
git rev-parse --abbrev-ref HEAD
|
||||
```
|
||||
|
||||
```shell
|
||||
git checkout patch-1
|
||||
git rev-parse --abbrev-ref HEAD # Prints `patch-1`
|
||||
```
|
||||
Reference in New Issue
Block a user