Ann
Ann

Reputation: 129

How to get list of git branches in Rails application?

Can I get list of branches in Rails app somehow? I need access to branches list of particular git repository(not repository of my app) in my app. So maybe some gem for this exists ?

Upvotes: 4

Views: 861

Answers (3)

Bijendra
Bijendra

Reputation: 10015

**git branch -a** 

displays all local and remote branches, while

**git branch -r** 

will display only the remote branches.

Upvotes: 0

Jenorish
Jenorish

Reputation: 1714

git branch --all and git branch -a both are same this command will display all branches.

$ git branch --all
asset_pipeline_changes
live
* master
secondary_menu
remotes/origin/master

Upvotes: 2

Jigar Bhatt
Jigar Bhatt

Reputation: 4650

The easiest way is just to use the git branch commands’ various options. -a shows all local and remote branches, while -r shows only remote branches.

$ git branch
* master

$ git branch -a
* master
 origin/1-2-stable
 origin/2-0-stable
 origin/2-1-stable
 origin/2-2-stable
 origin/3-0-unstable
 origin/HEAD
 origin/master

$ git branch -r
 origin/1-2-stable
 origin/2-0-stable
 origin/2-1-stable
 origin/2-2-stable
 origin/3-0-unstable
 origin/HEAD
 origin/master

Upvotes: 4

Related Questions