How to get a git repository's default branch in Ruby's "rugged" gem?

301 views Asked by At

Related to git - how to get default branch?

I'm trying to port a Bash script to Ruby. The script uses git symbolic-ref --short HEAD to get a repo's default branch.

Is there a way to combine rugged's repo.branches.each_name(:local) with some other command to find the default branch?

Or am I thinking too complicated and there is a useful default in rugged that I am missing? The script needs to continue by creating a new branch off the default/latest one, check-it out, commit something standardized, push the new branch, and open a pull request against that base branch.

0

There are 0 answers