class Geny::Actions::Git
Utilities for interacting with a git repo
Public Class Methods
new(shell:)
click to toggle source
Create a new Git
@param shell [Shell]
# File lib/geny/actions/git.rb, line 9 def initialize(shell:) @shell = shell end
Public Instance Methods
add(files: ["."], **opts)
click to toggle source
Stage files to be committed @param files [Array<String>] @raise [ExitError]
@example
git.add git.add files: ["Gemfile"]
# File lib/geny/actions/git.rb, line 29 def add(files: ["."], **opts) @shell.run("git", "add", *files, out: File::NULL, **opts) end
commit(message:, **opts)
click to toggle source
Commit staged files @param message [String] @raise [ExitError]
@example
git.commit message: "First commit"
# File lib/geny/actions/git.rb, line 39 def commit(message:, **opts) @shell.run("git", "commit", "-m", message, out: File::NULL, **opts) end
init(**opts)
click to toggle source
Initialize a new git repo @raise [ExitError]
@example
git.init
# File lib/geny/actions/git.rb, line 18 def init(**opts) @shell.run("git", "init", out: File::NULL, **opts) end
repo_path(**opts)
click to toggle source
Get the path to the current git repo @raise [ExitError]
@example
git.repo_path #=> "/path/to/repo"
# File lib/geny/actions/git.rb, line 48 def repo_path(**opts) @shell.capture("git", "rev-parse", "--show-toplevel", **opts) end