Skip to content

Instantly share code, notes, and snippets.

@mortenholmgaard
Created August 12, 2019 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mortenholmgaard/80e856227335412d706af3d7bccab955 to your computer and use it in GitHub Desktop.
Save mortenholmgaard/80e856227335412d706af3d7bccab955 to your computer and use it in GitHub Desktop.
def currentBranch()
branch = git_branch()
if !branch.to_s.empty?
return branch
end
git = Git.open(File.join(File.dirname(__FILE__), '../')) # git_branch() does not seem work on Windows, it will print error with path not found.
return git.current_branch
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment