Skip to content

Instantly share code, notes, and snippets.

@michaelbarton
Created March 21, 2011 20:10
Show Gist options
  • Save michaelbarton/880115 to your computer and use it in GitHub Desktop.
Save michaelbarton/880115 to your computer and use it in GitHub Desktop.
class Git < Thor
desc "branch", "Name of current branch"
def branch
puts branch_name
end
private
def git(command,args)
`git #{command} #{args}`
end
def branch_name
git('name-rev', '--name-only HEAD 2> /dev/null').strip
end
def master?
branch_name == "master"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment