From affd2f840a8c814b2f8597877399a018bae52647 Mon Sep 17 00:00:00 2001 From: "Hemanth.HM" Date: Sat, 19 Sep 2015 17:59:32 +0530 Subject: [PATCH] Get the name of the current branch --- README.md | 6 ++++++ tips.json | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 36cce35..253fcaf 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ * [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) * [Export a branch with history to the a file.](https://github.com/git-tips/tips#export-a-branch-with-history-to-the-a-file) * [Import form a bundle](https://github.com/git-tips/tips#import-form-a-bundle) +* [Get the name of current branch.](https://github.com/git-tips/tips#get-the-name-of-current-branch) @@ -431,5 +432,10 @@ git bundle create git clone repo.bundle -b ``` +## Get the name of current branch. +```sh +git rev-parse --abbrev-ref HEAD +``` + diff --git a/tips.json b/tips.json index 0e076de..02ccfdc 100644 --- a/tips.json +++ b/tips.json @@ -243,5 +243,9 @@ { "title": "Import form a bundle", "tip": "git clone repo.bundle -b " + }, + { + "title": "Get the name of current branch.", + "tip": "git rev-parse --abbrev-ref HEAD" } ]