Module: AIGit::Git
- Defined in:
- lib/ai_git/git.rb
Class Method Summary collapse
Class Method Details
.current_branch ⇒ Object
16 17 18 19 |
# File 'lib/ai_git/git.rb', line 16 def current_branch result = `git rev-parse --abbrev-ref HEAD` result.chomp end |
.diff ⇒ Object
12 13 14 |
# File 'lib/ai_git/git.rb', line 12 def diff `git diff --cached` end |
.run_command(cmd, args) ⇒ Object
21 22 23 24 |
# File 'lib/ai_git/git.rb', line 21 def run_command(cmd, args) system("#{cmd} #{args} > /dev/null 2>&1") raise "Command failed: #{cmd} #{args}" if $CHILD_STATUS.exitstatus != 0 end |
.staged_files ⇒ Object
8 9 10 |
# File 'lib/ai_git/git.rb', line 8 def staged_files `git diff --cached --name-only` end |