2 -----------------------------
7 Git::WorkingDirectory << Dir
11 Git::Commit << Git::Object
18 Git::File (in working dir)
23 Git::Remote << Git::Repository
28 # needs read permission only
30 g = Git.open (working_dir = '.')
39 g.log # returns array of Git::Commit objects
40 g.log.since('2 weeks ago')
41 g.log.between('v2.5', 'v2.6')
42 g.log.since('v2.5').file('Makefile')
43 g.log.each {|l| puts l.sha }
48 g.object('HEAD^').to_s # git show / git rev-parse
51 g.rev_parse('v2.5:Makefile') # returns Git::Object
54 g.file('flim/ChangeLog').tags.each {|tag,rev| p [tag,rev.to_s]}
55 g.file('flim/ChangeLog').logs.each { |log| log.sha }
57 g.branches # returns Git::Branch objects
63 g.tag # returns array of Git::Tag objects
67 g.grep('hello', Git::Tag)
70 g.ls_files(:stage => true)
74 g.diff(commit1, commit2)
75 g.diff("commit1..commit2")
77 g.diff_tree(Git::Tree, Git::Tree)
80 c = Git::Commit.new("HEAD^^")
81 c = Git::Commit.new("394839")
84 # needs write permission
86 g = Git.clone(URI, 'name', working_dir = GIT_DIR, {options})
87 (username, password, ssl_key, git_dir, index_file)
91 Git.init('/home/schacon/proj',
92 { :git_dir => '/opt/git/proj.git',
93 :index_file => '/tmp/index'} )
97 g.config('user.name', 'Scott Chacon')
98 g.config('user.email', 'email@email.com')
99 g.config('user.name') # returns 'Scott Chacon'
100 g.config # returns whole config hash
103 g.add([file1, file2])
105 g.remove('file.txt').and_file
108 g.commit_a('message')
110 g.reset # defaults to HEAD
111 g.reset_hard(Git::Commit)
113 g.branch('new_branch')
114 g.branch('new_branch').delete
116 g.checkout('new_branch')
117 g.checkout('new_branch', :create_branch => true)
118 g.checkout_b('new_branch')
120 g.merge('new_branch')
122 g.merge(Git::Branch, Git::Branch)
128 g.pull(Git::Repo, Git::Branch) # fetch and a merge
130 g.tag('tag_name') # returns Git::Tag
145 - author # git author
147 - committer # git author
148 - committer_date / date
170 Git::WorkingDirectory
172 - glob # returns Git::Files