Skip to content

Commit affd2f8

Browse files
committed
Get the name of the current branch
1 parent c0faf65 commit affd2f8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
* [Get latest changes in your repo for a linked project using subtree](https://github.com/git-tips/tips#get-latest-changes-in-your-repo-for-a-linked-project-using-subtree)
6262
* [Export a branch with history to the a file.](https://github.com/git-tips/tips#export-a-branch-with-history-to-the-a-file)
6363
* [Import form a bundle](https://github.com/git-tips/tips#import-form-a-bundle)
64+
* [Get the name of current branch.](https://github.com/git-tips/tips#get-the-name-of-current-branch)
6465

6566
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
6667
<!-- @doxie.inject end toc -->
@@ -431,5 +432,10 @@ git bundle create <file> <branch-name>
431432
git clone repo.bundle <repo-dir> -b <branch-name>
432433
```
433434

435+
## Get the name of current branch.
436+
```sh
437+
git rev-parse --abbrev-ref HEAD
438+
```
439+
434440
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
435441
<!-- @doxie.inject end -->

tips.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,9 @@
243243
{
244244
"title": "Import form a bundle",
245245
"tip": "git clone repo.bundle <repo-dir> -b <branch-name>"
246+
},
247+
{
248+
"title": "Get the name of current branch.",
249+
"tip": "git rev-parse --abbrev-ref HEAD"
246250
}
247251
]

0 commit comments

Comments
 (0)