1 <?xml version=
"1.0" encoding=
"iso-8859-1"?>
3 PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
8 <title>Class: Git::Base
</title>
9 <meta http-equiv=
"Content-Type" content=
"text/html; charset=iso-8859-1" />
10 <meta http-equiv=
"Content-Script-Type" content=
"text/javascript" />
11 <link rel=
"stylesheet" href=
"../.././rdoc-style.css" type=
"text/css" media=
"screen" />
12 <script type=
"text/javascript">
15 function popupCode( url ) {
16 window.open(url,
"Code",
"resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
19 function toggleCode( id ) {
20 if ( document.getElementById )
21 elem = document.getElementById( id );
22 else if ( document.all )
23 elem = eval(
"document.all." + id );
27 elemStyle = elem.style;
29 if ( elemStyle.display !=
"block" ) {
30 elemStyle.display =
"block"
32 elemStyle.display =
"none"
38 // Make codeblocks hidden by default
39 document.writeln(
"<style type=\"text/css\
">div.method-source-code { display: none }</style>" )
49 <div id=
"classHeader">
50 <table class=
"header-table">
51 <tr class=
"top-aligned-row">
52 <td><strong>Class
</strong></td>
53 <td class=
"class-name-in-header">Git::Base
</td>
55 <tr class=
"top-aligned-row">
56 <td><strong>In:
</strong></td>
58 <a href=
"../../files/lib/git/base_rb.html">
65 <tr class=
"top-aligned-row">
66 <td><strong>Parent:
</strong></td>
68 <a href=
"Object.html">
75 <!-- banner header -->
77 <div id=
"bodyContent">
81 <div id=
"contextContent">
87 <div id=
"method-list">
88 <h3 class=
"section-bar">Methods
</h3>
90 <div class=
"name-list">
91 <a href=
"#M000114">add
</a>
92 <a href=
"#M000126">add_remote
</a>
93 <a href=
"#M000129">add_tag
</a>
94 <a href=
"#M000130">archive
</a>
95 <a href=
"#M000089">bare
</a>
96 <a href=
"#M000109">branch
</a>
97 <a href=
"#M000108">branches
</a>
98 <a href=
"#M000099">chdir
</a>
99 <a href=
"#M000120">checkout
</a>
100 <a href=
"#M000134">checkout_index
</a>
101 <a href=
"#M000092">clone
</a>
102 <a href=
"#M000118">commit
</a>
103 <a href=
"#M000119">commit_all
</a>
104 <a href=
"#M000137">commit_tree
</a>
105 <a href=
"#M000101">config
</a>
106 <a href=
"#M000144">current_branch
</a>
107 <a href=
"#M000113">diff
</a>
108 <a href=
"#M000094">dir
</a>
109 <a href=
"#M000121">fetch
</a>
110 <a href=
"#M000105">gblob
</a>
111 <a href=
"#M000104">gcommit
</a>
112 <a href=
"#M000112">grep
</a>
113 <a href=
"#M000103">gtree
</a>
114 <a href=
"#M000096">index
</a>
115 <a href=
"#M000091">init
</a>
116 <a href=
"#M000111">lib
</a>
117 <a href=
"#M000106">log
</a>
118 <a href=
"#M000140">ls_files
</a>
119 <a href=
"#M000123">merge
</a>
120 <a href=
"#M000093">new
</a>
121 <a href=
"#M000102">object
</a>
122 <a href=
"#M000090">open
</a>
123 <a href=
"#M000124">pull
</a>
124 <a href=
"#M000122">push
</a>
125 <a href=
"#M000135">read_tree
</a>
126 <a href=
"#M000110">remote
</a>
127 <a href=
"#M000125">remotes
</a>
128 <a href=
"#M000115">remove
</a>
129 <a href=
"#M000131">repack
</a>
130 <a href=
"#M000095">repo
</a>
131 <a href=
"#M000100">repo_size
</a>
132 <a href=
"#M000116">reset
</a>
133 <a href=
"#M000117">reset_hard
</a>
134 <a href=
"#M000143">revparse
</a>
135 <a href=
"#M000098">set_index
</a>
136 <a href=
"#M000097">set_working
</a>
137 <a href=
"#M000107">status
</a>
138 <a href=
"#M000128">tag
</a>
139 <a href=
"#M000127">tags
</a>
140 <a href=
"#M000139">update_ref
</a>
141 <a href=
"#M000132">with_index
</a>
142 <a href=
"#M000133">with_temp_index
</a>
143 <a href=
"#M000142">with_temp_working
</a>
144 <a href=
"#M000141">with_working
</a>
145 <a href=
"#M000138">write_and_commit_tree
</a>
146 <a href=
"#M000136">write_tree
</a>
164 <!-- if method_list -->
166 <h3 class=
"section-bar">Public Class methods
</h3>
168 <div id=
"method-M000089" class=
"method-detail">
169 <a name=
"M000089"></a>
171 <div class=
"method-heading">
172 <a href=
"#M000089" class=
"method-signature">
173 <span class=
"method-name">bare
</span><span class=
"method-args">(git_dir)
</span>
177 <div class=
"method-description">
179 opens a bare
<a href=
"../Git.html">Git
</a> <a
180 href=
"Repository.html">Repository
</a> - no working directory options
182 <p><a class=
"source-toggle" href=
"#"
183 onclick=
"toggleCode('M000089-source');return false;">[Source]
</a></p>
184 <div class=
"method-source-code" id=
"M000089-source">
186 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
12</span>
187 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">bare
</span>(
<span class=
"ruby-identifier">git_dir
</span>)
188 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">new
</span> <span class=
"ruby-identifier">:repository
</span> =
<span class=
"ruby-operator">></span> <span class=
"ruby-identifier">git_dir
</span>
189 <span class=
"ruby-keyword kw">end
</span>
195 <div id=
"method-M000092" class=
"method-detail">
196 <a name=
"M000092"></a>
198 <div class=
"method-heading">
199 <a href=
"#M000092" class=
"method-signature">
200 <span class=
"method-name">clone
</span><span class=
"method-args">(repository, name, opts = {})
</span>
204 <div class=
"method-description">
206 clones a git repository locally
209 repository - http://repo.or.cz/w/sinatra.git
223 <p><a class=
"source-toggle" href=
"#"
224 onclick=
"toggleCode('M000092-source');return false;">[Source]
</a></p>
225 <div class=
"method-source-code" id=
"M000092-source">
227 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
60</span>
228 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">clone
</span>(
<span class=
"ruby-identifier">repository
</span>,
<span class=
"ruby-identifier">name
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
229 <span class=
"ruby-comment cmt"># run git-clone
</span>
230 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Lib
</span>.
<span class=
"ruby-identifier">new
</span>.
<span class=
"ruby-identifier">clone
</span>(
<span class=
"ruby-identifier">repository
</span>,
<span class=
"ruby-identifier">name
</span>,
<span class=
"ruby-identifier">opts
</span>))
231 <span class=
"ruby-keyword kw">end
</span>
237 <div id=
"method-M000091" class=
"method-detail">
238 <a name=
"M000091"></a>
240 <div class=
"method-heading">
241 <a href=
"#M000091" class=
"method-signature">
242 <span class=
"method-name">init
</span><span class=
"method-args">(working_dir, opts = {})
</span>
246 <div class=
"method-description">
248 initializes a git repository
257 <p><a class=
"source-toggle" href=
"#"
258 onclick=
"toggleCode('M000091-source');return false;">[Source]
</a></p>
259 <div class=
"method-source-code" id=
"M000091-source">
261 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
31</span>
262 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">init
</span>(
<span class=
"ruby-identifier">working_dir
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
263 <span class=
"ruby-identifier">default
</span> = {
<span class=
"ruby-identifier">:working_directory
</span> =
<span class=
"ruby-operator">></span> <span class=
"ruby-identifier">working_dir
</span>,
264 <span class=
"ruby-identifier">:repository
</span> =
<span class=
"ruby-operator">></span> <span class=
"ruby-constant">File
</span>.
<span class=
"ruby-identifier">join
</span>(
<span class=
"ruby-identifier">working_dir
</span>,
<span class=
"ruby-value str">'.git'
</span>)}
265 <span class=
"ruby-identifier">git_options
</span> =
<span class=
"ruby-identifier">default
</span>.
<span class=
"ruby-identifier">merge
</span>(
<span class=
"ruby-identifier">opts
</span>)
267 <span class=
"ruby-keyword kw">if
</span> <span class=
"ruby-identifier">git_options
</span>[
<span class=
"ruby-identifier">:working_directory
</span>]
268 <span class=
"ruby-comment cmt"># if !working_dir, make it
</span>
269 <span class=
"ruby-constant">FileUtils
</span>.
<span class=
"ruby-identifier">mkdir_p
</span>(
<span class=
"ruby-identifier">git_options
</span>[
<span class=
"ruby-identifier">:working_directory
</span>])
<span class=
"ruby-keyword kw">if
</span> <span class=
"ruby-operator">!
</span><span class=
"ruby-constant">File
</span>.
<span class=
"ruby-identifier">directory?
</span>(
<span class=
"ruby-identifier">git_options
</span>[
<span class=
"ruby-identifier">:working_directory
</span>])
270 <span class=
"ruby-keyword kw">end
</span>
272 <span class=
"ruby-comment cmt"># run git_init there
</span>
273 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Lib
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">git_options
</span>).
<span class=
"ruby-identifier">init
</span>
275 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">git_options
</span>)
276 <span class=
"ruby-keyword kw">end
</span>
282 <div id=
"method-M000093" class=
"method-detail">
283 <a name=
"M000093"></a>
285 <div class=
"method-heading">
286 <a href=
"#M000093" class=
"method-signature">
287 <span class=
"method-name">new
</span><span class=
"method-args">(options = {})
</span>
291 <div class=
"method-description">
292 <p><a class=
"source-toggle" href=
"#"
293 onclick=
"toggleCode('M000093-source');return false;">[Source]
</a></p>
294 <div class=
"method-source-code" id=
"M000093-source">
296 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
65</span>
297 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">initialize
</span>(
<span class=
"ruby-identifier">options
</span> = {})
298 <span class=
"ruby-keyword kw">if
</span> <span class=
"ruby-identifier">working_dir
</span> =
<span class=
"ruby-identifier">options
</span>[
<span class=
"ruby-identifier">:working_directory
</span>]
299 <span class=
"ruby-identifier">options
</span>[
<span class=
"ruby-identifier">:repository
</span>] =
<span class=
"ruby-constant">File
</span>.
<span class=
"ruby-identifier">join
</span>(
<span class=
"ruby-identifier">working_dir
</span>,
<span class=
"ruby-value str">'.git'
</span>)
<span class=
"ruby-keyword kw">if
</span> <span class=
"ruby-operator">!
</span><span class=
"ruby-identifier">options
</span>[
<span class=
"ruby-identifier">:repository
</span>]
300 <span class=
"ruby-identifier">options
</span>[
<span class=
"ruby-identifier">:index
</span>] =
<span class=
"ruby-constant">File
</span>.
<span class=
"ruby-identifier">join
</span>(
<span class=
"ruby-identifier">working_dir
</span>,
<span class=
"ruby-value str">'.git'
</span>,
<span class=
"ruby-value str">'index'
</span>)
<span class=
"ruby-keyword kw">if
</span> <span class=
"ruby-operator">!
</span><span class=
"ruby-identifier">options
</span>[
<span class=
"ruby-identifier">:index
</span>]
301 <span class=
"ruby-keyword kw">end
</span>
303 <span class=
"ruby-ivar">@working_directory
</span> =
<span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">WorkingDirectory
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">options
</span>[
<span class=
"ruby-identifier">:working_directory
</span>])
<span class=
"ruby-keyword kw">if
</span> <span class=
"ruby-identifier">options
</span>[
<span class=
"ruby-identifier">:working_directory
</span>]
304 <span class=
"ruby-ivar">@repository
</span> =
<span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Repository
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">options
</span>[
<span class=
"ruby-identifier">:repository
</span>])
<span class=
"ruby-keyword kw">if
</span> <span class=
"ruby-identifier">options
</span>[
<span class=
"ruby-identifier">:repository
</span>]
305 <span class=
"ruby-ivar">@index
</span> =
<span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Index
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">options
</span>[
<span class=
"ruby-identifier">:index
</span>],
<span class=
"ruby-keyword kw">false
</span>)
<span class=
"ruby-keyword kw">if
</span> <span class=
"ruby-identifier">options
</span>[
<span class=
"ruby-identifier">:index
</span>]
306 <span class=
"ruby-keyword kw">end
</span>
312 <div id=
"method-M000090" class=
"method-detail">
313 <a name=
"M000090"></a>
315 <div class=
"method-heading">
316 <a href=
"#M000090" class=
"method-signature">
317 <span class=
"method-name">open
</span><span class=
"method-args">(working_dir, opts={})
</span>
321 <div class=
"method-description">
323 opens a new
<a href=
"../Git.html">Git
</a> Project from a working directory
324 you can specify non-standard git_dir and index file in the options
326 <p><a class=
"source-toggle" href=
"#"
327 onclick=
"toggleCode('M000090-source');return false;">[Source]
</a></p>
328 <div class=
"method-source-code" id=
"M000090-source">
330 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
18</span>
331 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">open
</span>(
<span class=
"ruby-identifier">working_dir
</span>,
<span class=
"ruby-identifier">opts
</span>={})
332 <span class=
"ruby-identifier">default
</span> = {
<span class=
"ruby-identifier">:working_directory
</span> =
<span class=
"ruby-operator">></span> <span class=
"ruby-identifier">working_dir
</span>}
333 <span class=
"ruby-identifier">git_options
</span> =
<span class=
"ruby-identifier">default
</span>.
<span class=
"ruby-identifier">merge
</span>(
<span class=
"ruby-identifier">opts
</span>)
335 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">git_options
</span>)
336 <span class=
"ruby-keyword kw">end
</span>
342 <h3 class=
"section-bar">Public Instance methods
</h3>
344 <div id=
"method-M000114" class=
"method-detail">
345 <a name=
"M000114"></a>
347 <div class=
"method-heading">
348 <a href=
"#M000114" class=
"method-signature">
349 <span class=
"method-name">add
</span><span class=
"method-args">(path = '.')
</span>
353 <div class=
"method-description">
355 adds files from the working directory to the git repository
357 <p><a class=
"source-toggle" href=
"#"
358 onclick=
"toggleCode('M000114-source');return false;">[Source]
</a></p>
359 <div class=
"method-source-code" id=
"M000114-source">
361 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
234</span>
362 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">add
</span>(
<span class=
"ruby-identifier">path
</span> =
<span class=
"ruby-value str">'.'
</span>)
363 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">add
</span>(
<span class=
"ruby-identifier">path
</span>)
364 <span class=
"ruby-keyword kw">end
</span>
370 <div id=
"method-M000126" class=
"method-detail">
371 <a name=
"M000126"></a>
373 <div class=
"method-heading">
374 <a href=
"#M000126" class=
"method-signature">
375 <span class=
"method-name">add_remote
</span><span class=
"method-args">(name, url, opts = {})
</span>
379 <div class=
"method-description">
381 adds a new remote to this repository url can be a git url or a
<a
382 href=
"Base.html">Git::Base
</a> object if it
’s a local reference
385 @git.add_remote('scotts_git', 'git://repo.or.cz/rubygit.git')
386 @git.fetch('scotts_git')
387 @git.merge('scotts_git/master')
389 <p><a class=
"source-toggle" href=
"#"
390 onclick=
"toggleCode('M000126-source');return false;">[Source]
</a></p>
391 <div class=
"method-source-code" id=
"M000126-source">
393 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
312</span>
394 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">add_remote
</span>(
<span class=
"ruby-identifier">name
</span>,
<span class=
"ruby-identifier">url
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
395 <span class=
"ruby-keyword kw">if
</span> <span class=
"ruby-identifier">url
</span>.
<span class=
"ruby-identifier">is_a?
</span>(
<span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Base
</span>)
396 <span class=
"ruby-identifier">url
</span> =
<span class=
"ruby-identifier">url
</span>.
<span class=
"ruby-identifier">repo
</span>.
<span class=
"ruby-identifier">path
</span>
397 <span class=
"ruby-keyword kw">end
</span>
398 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">remote_add
</span>(
<span class=
"ruby-identifier">name
</span>,
<span class=
"ruby-identifier">url
</span>,
<span class=
"ruby-identifier">opts
</span>)
399 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Remote
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-identifier">name
</span>)
400 <span class=
"ruby-keyword kw">end
</span>
406 <div id=
"method-M000129" class=
"method-detail">
407 <a name=
"M000129"></a>
409 <div class=
"method-heading">
410 <a href=
"#M000129" class=
"method-signature">
411 <span class=
"method-name">add_tag
</span><span class=
"method-args">(tag_name)
</span>
415 <div class=
"method-description">
417 creates a new git tag (Git::Tag)
419 <p><a class=
"source-toggle" href=
"#"
420 onclick=
"toggleCode('M000129-source');return false;">[Source]
</a></p>
421 <div class=
"method-source-code" id=
"M000129-source">
423 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
331</span>
424 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">add_tag
</span>(
<span class=
"ruby-identifier">tag_name
</span>)
425 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">tag
</span>(
<span class=
"ruby-identifier">tag_name
</span>)
426 <span class=
"ruby-identifier">tag
</span>(
<span class=
"ruby-identifier">tag_name
</span>)
427 <span class=
"ruby-keyword kw">end
</span>
433 <div id=
"method-M000130" class=
"method-detail">
434 <a name=
"M000130"></a>
436 <div class=
"method-heading">
437 <a href=
"#M000130" class=
"method-signature">
438 <span class=
"method-name">archive
</span><span class=
"method-args">(treeish, file = nil, opts = {})
</span>
442 <div class=
"method-description">
444 creates an archive file of the given tree-ish
446 <p><a class=
"source-toggle" href=
"#"
447 onclick=
"toggleCode('M000130-source');return false;">[Source]
</a></p>
448 <div class=
"method-source-code" id=
"M000130-source">
450 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
337</span>
451 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">archive
</span>(
<span class=
"ruby-identifier">treeish
</span>,
<span class=
"ruby-identifier">file
</span> =
<span class=
"ruby-keyword kw">nil
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
452 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">object
</span>(
<span class=
"ruby-identifier">treeish
</span>).
<span class=
"ruby-identifier">archive
</span>(
<span class=
"ruby-identifier">file
</span>,
<span class=
"ruby-identifier">opts
</span>)
453 <span class=
"ruby-keyword kw">end
</span>
459 <div id=
"method-M000109" class=
"method-detail">
460 <a name=
"M000109"></a>
462 <div class=
"method-heading">
463 <a href=
"#M000109" class=
"method-signature">
464 <span class=
"method-name">branch
</span><span class=
"method-args">(branch_name = 'master')
</span>
468 <div class=
"method-description">
470 returns a
<a href=
"Branch.html">Git::Branch
</a> object for branch_name
472 <p><a class=
"source-toggle" href=
"#"
473 onclick=
"toggleCode('M000109-source');return false;">[Source]
</a></p>
474 <div class=
"method-source-code" id=
"M000109-source">
476 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
189</span>
477 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">branch
</span>(
<span class=
"ruby-identifier">branch_name
</span> =
<span class=
"ruby-value str">'master'
</span>)
478 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Branch
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-identifier">branch_name
</span>)
479 <span class=
"ruby-keyword kw">end
</span>
485 <div id=
"method-M000108" class=
"method-detail">
486 <a name=
"M000108"></a>
488 <div class=
"method-heading">
489 <a href=
"#M000108" class=
"method-signature">
490 <span class=
"method-name">branches
</span><span class=
"method-args">()
</span>
494 <div class=
"method-description">
496 returns a
<a href=
"Branches.html">Git::Branches
</a> object of all the
<a
497 href=
"Branch.html">Git::Branch
</a> objects for this repo
499 <p><a class=
"source-toggle" href=
"#"
500 onclick=
"toggleCode('M000108-source');return false;">[Source]
</a></p>
501 <div class=
"method-source-code" id=
"M000108-source">
503 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
184</span>
504 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">branches
</span>
505 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Branches
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>)
506 <span class=
"ruby-keyword kw">end
</span>
512 <div id=
"method-M000099" class=
"method-detail">
513 <a name=
"M000099"></a>
515 <div class=
"method-heading">
516 <a href=
"#M000099" class=
"method-signature">
517 <span class=
"method-name">chdir
</span><span class=
"method-args">() {|dir.path| ...}
</span>
521 <div class=
"method-description">
523 changes current working directory for a block to the git working directory
532 @git.commit('message')
535 <p><a class=
"source-toggle" href=
"#"
536 onclick=
"toggleCode('M000099-source');return false;">[Source]
</a></p>
537 <div class=
"method-source-code" id=
"M000099-source">
539 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
115</span>
540 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">chdir
</span>
541 <span class=
"ruby-constant">Dir
</span>.
<span class=
"ruby-identifier">chdir
</span>(
<span class=
"ruby-identifier">dir
</span>.
<span class=
"ruby-identifier">path
</span>)
<span class=
"ruby-keyword kw">do
</span>
542 <span class=
"ruby-keyword kw">yield
</span> <span class=
"ruby-identifier">dir
</span>.
<span class=
"ruby-identifier">path
</span>
543 <span class=
"ruby-keyword kw">end
</span>
544 <span class=
"ruby-keyword kw">end
</span>
550 <div id=
"method-M000120" class=
"method-detail">
551 <a name=
"M000120"></a>
553 <div class=
"method-heading">
554 <a href=
"#M000120" class=
"method-signature">
555 <span class=
"method-name">checkout
</span><span class=
"method-args">(branch = 'master', opts = {})
</span>
559 <div class=
"method-description">
561 checks out a branch as the new git working directory
563 <p><a class=
"source-toggle" href=
"#"
564 onclick=
"toggleCode('M000120-source');return false;">[Source]
</a></p>
565 <div class=
"method-source-code" id=
"M000120-source">
567 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
268</span>
568 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">checkout
</span>(
<span class=
"ruby-identifier">branch
</span> =
<span class=
"ruby-value str">'master'
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
569 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">checkout
</span>(
<span class=
"ruby-identifier">branch
</span>,
<span class=
"ruby-identifier">opts
</span>)
570 <span class=
"ruby-keyword kw">end
</span>
576 <div id=
"method-M000134" class=
"method-detail">
577 <a name=
"M000134"></a>
579 <div class=
"method-heading">
580 <a href=
"#M000134" class=
"method-signature">
581 <span class=
"method-name">checkout_index
</span><span class=
"method-args">(opts = {})
</span>
585 <div class=
"method-description">
586 <p><a class=
"source-toggle" href=
"#"
587 onclick=
"toggleCode('M000134-source');return false;">[Source]
</a></p>
588 <div class=
"method-source-code" id=
"M000134-source">
590 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
364</span>
591 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">checkout_index
</span>(
<span class=
"ruby-identifier">opts
</span> = {})
592 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">checkout_index
</span>(
<span class=
"ruby-identifier">opts
</span>)
593 <span class=
"ruby-keyword kw">end
</span>
599 <div id=
"method-M000118" class=
"method-detail">
600 <a name=
"M000118"></a>
602 <div class=
"method-heading">
603 <a href=
"#M000118" class=
"method-signature">
604 <span class=
"method-name">commit
</span><span class=
"method-args">(message, opts = {})
</span>
608 <div class=
"method-description">
610 commits all pending changes in the index file to the git repository
612 <p><a class=
"source-toggle" href=
"#"
613 onclick=
"toggleCode('M000118-source');return false;">[Source]
</a></p>
614 <div class=
"method-source-code" id=
"M000118-source">
616 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
255</span>
617 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">commit
</span>(
<span class=
"ruby-identifier">message
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
618 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">commit
</span>(
<span class=
"ruby-identifier">message
</span>,
<span class=
"ruby-identifier">opts
</span>)
619 <span class=
"ruby-keyword kw">end
</span>
625 <div id=
"method-M000119" class=
"method-detail">
626 <a name=
"M000119"></a>
628 <div class=
"method-heading">
629 <a href=
"#M000119" class=
"method-signature">
630 <span class=
"method-name">commit_all
</span><span class=
"method-args">(message, opts = {})
</span>
634 <div class=
"method-description">
636 commits all pending changes in the index file to the git repository, but
637 automatically adds all modified files without having to explicitly calling
640 <p><a class=
"source-toggle" href=
"#"
641 onclick=
"toggleCode('M000119-source');return false;">[Source]
</a></p>
642 <div class=
"method-source-code" id=
"M000119-source">
644 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
262</span>
645 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">commit_all
</span>(
<span class=
"ruby-identifier">message
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
646 <span class=
"ruby-identifier">opts
</span> = {
<span class=
"ruby-identifier">:add_all
</span> =
<span class=
"ruby-operator">></span> <span class=
"ruby-keyword kw">true
</span>}.
<span class=
"ruby-identifier">merge
</span>(
<span class=
"ruby-identifier">opts
</span>)
647 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">commit
</span>(
<span class=
"ruby-identifier">message
</span>,
<span class=
"ruby-identifier">opts
</span>)
648 <span class=
"ruby-keyword kw">end
</span>
654 <div id=
"method-M000137" class=
"method-detail">
655 <a name=
"M000137"></a>
657 <div class=
"method-heading">
658 <a href=
"#M000137" class=
"method-signature">
659 <span class=
"method-name">commit_tree
</span><span class=
"method-args">(tree = nil, opts = {})
</span>
663 <div class=
"method-description">
664 <p><a class=
"source-toggle" href=
"#"
665 onclick=
"toggleCode('M000137-source');return false;">[Source]
</a></p>
666 <div class=
"method-source-code" id=
"M000137-source">
668 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
376</span>
669 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">commit_tree
</span>(
<span class=
"ruby-identifier">tree
</span> =
<span class=
"ruby-keyword kw">nil
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
670 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Object
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Commit
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">commit_tree
</span>(
<span class=
"ruby-identifier">tree
</span>,
<span class=
"ruby-identifier">opts
</span>))
671 <span class=
"ruby-keyword kw">end
</span>
677 <div id=
"method-M000101" class=
"method-detail">
678 <a name=
"M000101"></a>
680 <div class=
"method-heading">
681 <a href=
"#M000101" class=
"method-signature">
682 <span class=
"method-name">config
</span><span class=
"method-args">(name = nil, value = nil)
</span>
686 <div class=
"method-description">
688 g.config(
‘user.name
’,
‘Scott Chacon
’) # sets value
689 g.config(
‘user.email
’,
‘email@email.com
’) # sets
690 value g.config(
‘user.name
’) # returns
‘Scott
691 Chacon
’ g.config # returns whole config hash
693 <p><a class=
"source-toggle" href=
"#"
694 onclick=
"toggleCode('M000101-source');return false;">[Source]
</a></p>
695 <div class=
"method-source-code" id=
"M000101-source">
697 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
134</span>
698 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">config
</span>(
<span class=
"ruby-identifier">name
</span> =
<span class=
"ruby-keyword kw">nil
</span>,
<span class=
"ruby-identifier">value
</span> =
<span class=
"ruby-keyword kw">nil
</span>)
699 <span class=
"ruby-keyword kw">if
</span>(
<span class=
"ruby-identifier">name
</span> <span class=
"ruby-operator">&&</span> <span class=
"ruby-identifier">value
</span>)
700 <span class=
"ruby-comment cmt"># set value
</span>
701 <span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">config_set
</span>(
<span class=
"ruby-identifier">name
</span>,
<span class=
"ruby-identifier">value
</span>)
702 <span class=
"ruby-keyword kw">elsif
</span> (
<span class=
"ruby-identifier">name
</span>)
703 <span class=
"ruby-comment cmt"># return value
</span>
704 <span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">config_get
</span>(
<span class=
"ruby-identifier">name
</span>)
705 <span class=
"ruby-keyword kw">else
</span>
706 <span class=
"ruby-comment cmt"># return hash
</span>
707 <span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">config_list
</span>
708 <span class=
"ruby-keyword kw">end
</span>
709 <span class=
"ruby-keyword kw">end
</span>
715 <div id=
"method-M000144" class=
"method-detail">
716 <a name=
"M000144"></a>
718 <div class=
"method-heading">
719 <a href=
"#M000144" class=
"method-signature">
720 <span class=
"method-name">current_branch
</span><span class=
"method-args">()
</span>
724 <div class=
"method-description">
726 returns the name of the branch the working directory is currently on
728 <p><a class=
"source-toggle" href=
"#"
729 onclick=
"toggleCode('M000144-source');return false;">[Source]
</a></p>
730 <div class=
"method-source-code" id=
"M000144-source">
732 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
425</span>
733 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">current_branch
</span>
734 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">branch_current
</span>
735 <span class=
"ruby-keyword kw">end
</span>
741 <div id=
"method-M000113" class=
"method-detail">
742 <a name=
"M000113"></a>
744 <div class=
"method-heading">
745 <a href=
"#M000113" class=
"method-signature">
746 <span class=
"method-name">diff
</span><span class=
"method-args">(objectish = 'HEAD', obj2 = nil)
</span>
750 <div class=
"method-description">
752 returns a
<a href=
"Diff.html">Git::Diff
</a> object
754 <p><a class=
"source-toggle" href=
"#"
755 onclick=
"toggleCode('M000113-source');return false;">[Source]
</a></p>
756 <div class=
"method-source-code" id=
"M000113-source">
758 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
229</span>
759 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">diff
</span>(
<span class=
"ruby-identifier">objectish
</span> =
<span class=
"ruby-value str">'HEAD'
</span>,
<span class=
"ruby-identifier">obj2
</span> =
<span class=
"ruby-keyword kw">nil
</span>)
760 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Diff
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-identifier">objectish
</span>,
<span class=
"ruby-identifier">obj2
</span>)
761 <span class=
"ruby-keyword kw">end
</span>
767 <div id=
"method-M000094" class=
"method-detail">
768 <a name=
"M000094"></a>
770 <div class=
"method-heading">
771 <a href=
"#M000094" class=
"method-signature">
772 <span class=
"method-name">dir
</span><span class=
"method-args">()
</span>
776 <div class=
"method-description">
778 returns a reference to the working directory
784 <p><a class=
"source-toggle" href=
"#"
785 onclick=
"toggleCode('M000094-source');return false;">[Source]
</a></p>
786 <div class=
"method-source-code" id=
"M000094-source">
788 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
80</span>
789 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">dir
</span>
790 <span class=
"ruby-ivar">@working_directory
</span>
791 <span class=
"ruby-keyword kw">end
</span>
797 <div id=
"method-M000121" class=
"method-detail">
798 <a name=
"M000121"></a>
800 <div class=
"method-heading">
801 <a href=
"#M000121" class=
"method-signature">
802 <span class=
"method-name">fetch
</span><span class=
"method-args">(remote = 'origin')
</span>
806 <div class=
"method-description">
808 fetches changes from a remote branch - this does not modify the working
809 directory, it just gets the changes from the remote if there are any
811 <p><a class=
"source-toggle" href=
"#"
812 onclick=
"toggleCode('M000121-source');return false;">[Source]
</a></p>
813 <div class=
"method-source-code" id=
"M000121-source">
815 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
274</span>
816 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">fetch
</span>(
<span class=
"ruby-identifier">remote
</span> =
<span class=
"ruby-value str">'origin'
</span>)
817 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">fetch
</span>(
<span class=
"ruby-identifier">remote
</span>)
818 <span class=
"ruby-keyword kw">end
</span>
824 <div id=
"method-M000105" class=
"method-detail">
825 <a name=
"M000105"></a>
827 <div class=
"method-heading">
828 <a href=
"#M000105" class=
"method-signature">
829 <span class=
"method-name">gblob
</span><span class=
"method-args">(objectish)
</span>
833 <div class=
"method-description">
834 <p><a class=
"source-toggle" href=
"#"
835 onclick=
"toggleCode('M000105-source');return false;">[Source]
</a></p>
836 <div class=
"method-source-code" id=
"M000105-source">
838 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
169</span>
839 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">gblob
</span>(
<span class=
"ruby-identifier">objectish
</span>)
840 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Object
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-identifier">objectish
</span>,
<span class=
"ruby-value str">'blob'
</span>)
841 <span class=
"ruby-keyword kw">end
</span>
847 <div id=
"method-M000104" class=
"method-detail">
848 <a name=
"M000104"></a>
850 <div class=
"method-heading">
851 <a href=
"#M000104" class=
"method-signature">
852 <span class=
"method-name">gcommit
</span><span class=
"method-args">(objectish)
</span>
856 <div class=
"method-description">
857 <p><a class=
"source-toggle" href=
"#"
858 onclick=
"toggleCode('M000104-source');return false;">[Source]
</a></p>
859 <div class=
"method-source-code" id=
"M000104-source">
861 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
165</span>
862 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">gcommit
</span>(
<span class=
"ruby-identifier">objectish
</span>)
863 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Object
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-identifier">objectish
</span>,
<span class=
"ruby-value str">'commit'
</span>)
864 <span class=
"ruby-keyword kw">end
</span>
870 <div id=
"method-M000112" class=
"method-detail">
871 <a name=
"M000112"></a>
873 <div class=
"method-heading">
874 <a href=
"#M000112" class=
"method-signature">
875 <span class=
"method-name">grep
</span><span class=
"method-args">(string)
</span>
879 <div class=
"method-description">
881 will run a grep for
‘string
’ on the HEAD of the git repository
884 to be more surgical in your grep, you can call grep() off a specific git
888 @git.object(
"v2.3
").grep('TODO')
891 in any case, it returns a hash of arrays of the type:
894 hsh[tree-ish] = [[line_no, match], [line_no, match2]]
895 hsh[tree-ish] = [[line_no, match], [line_no, match2]]
898 so you might use it like this:
901 @git.grep(
"TODO
").each do |sha, arr|
902 puts
"in blob #{sha}:
"
904 puts
"\t line #{match[
0]}: '#{match[
1]}'
"
908 <p><a class=
"source-toggle" href=
"#"
909 onclick=
"toggleCode('M000112-source');return false;">[Source]
</a></p>
910 <div class=
"method-source-code" id=
"M000112-source">
912 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
224</span>
913 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">grep
</span>(
<span class=
"ruby-identifier">string
</span>)
914 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">object
</span>(
<span class=
"ruby-value str">'HEAD'
</span>).
<span class=
"ruby-identifier">grep
</span>(
<span class=
"ruby-identifier">string
</span>)
915 <span class=
"ruby-keyword kw">end
</span>
921 <div id=
"method-M000103" class=
"method-detail">
922 <a name=
"M000103"></a>
924 <div class=
"method-heading">
925 <a href=
"#M000103" class=
"method-signature">
926 <span class=
"method-name">gtree
</span><span class=
"method-args">(objectish)
</span>
930 <div class=
"method-description">
931 <p><a class=
"source-toggle" href=
"#"
932 onclick=
"toggleCode('M000103-source');return false;">[Source]
</a></p>
933 <div class=
"method-source-code" id=
"M000103-source">
935 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
161</span>
936 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">gtree
</span>(
<span class=
"ruby-identifier">objectish
</span>)
937 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Object
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-identifier">objectish
</span>,
<span class=
"ruby-value str">'tree'
</span>)
938 <span class=
"ruby-keyword kw">end
</span>
944 <div id=
"method-M000096" class=
"method-detail">
945 <a name=
"M000096"></a>
947 <div class=
"method-heading">
948 <a href=
"#M000096" class=
"method-signature">
949 <span class=
"method-name">index
</span><span class=
"method-args">()
</span>
953 <div class=
"method-description">
955 returns reference to the git index file
957 <p><a class=
"source-toggle" href=
"#"
958 onclick=
"toggleCode('M000096-source');return false;">[Source]
</a></p>
959 <div class=
"method-source-code" id=
"M000096-source">
961 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
91</span>
962 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">index
</span>
963 <span class=
"ruby-ivar">@index
</span>
964 <span class=
"ruby-keyword kw">end
</span>
970 <div id=
"method-M000111" class=
"method-detail">
971 <a name=
"M000111"></a>
973 <div class=
"method-heading">
974 <a href=
"#M000111" class=
"method-signature">
975 <span class=
"method-name">lib
</span><span class=
"method-args">()
</span>
979 <div class=
"method-description">
981 this is a convenience method for accessing the class that wraps all the
982 actual
‘git
’ forked system calls. At some point I hope to
983 replace the
<a href=
"Lib.html">Git::Lib
</a> class with one that uses native
984 methods or libgit C bindings
986 <p><a class=
"source-toggle" href=
"#"
987 onclick=
"toggleCode('M000111-source');return false;">[Source]
</a></p>
988 <div class=
"method-source-code" id=
"M000111-source">
990 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
201</span>
991 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">lib
</span>
992 <span class=
"ruby-ivar">@lib
</span> <span class=
"ruby-operator">||=
</span> <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Lib
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>)
993 <span class=
"ruby-keyword kw">end
</span>
999 <div id=
"method-M000106" class=
"method-detail">
1000 <a name=
"M000106"></a>
1002 <div class=
"method-heading">
1003 <a href=
"#M000106" class=
"method-signature">
1004 <span class=
"method-name">log
</span><span class=
"method-args">(count =
30)
</span>
1008 <div class=
"method-description">
1010 returns a
<a href=
"Log.html">Git::Log
</a> object with count commits
1012 <p><a class=
"source-toggle" href=
"#"
1013 onclick=
"toggleCode('M000106-source');return false;">[Source]
</a></p>
1014 <div class=
"method-source-code" id=
"M000106-source">
1016 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
174</span>
1017 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">log
</span>(
<span class=
"ruby-identifier">count
</span> =
<span class=
"ruby-value">30</span>)
1018 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Log
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-identifier">count
</span>)
1019 <span class=
"ruby-keyword kw">end
</span>
1025 <div id=
"method-M000140" class=
"method-detail">
1026 <a name=
"M000140"></a>
1028 <div class=
"method-heading">
1029 <a href=
"#M000140" class=
"method-signature">
1030 <span class=
"method-name">ls_files
</span><span class=
"method-args">()
</span>
1034 <div class=
"method-description">
1035 <p><a class=
"source-toggle" href=
"#"
1036 onclick=
"toggleCode('M000140-source');return false;">[Source]
</a></p>
1037 <div class=
"method-source-code" id=
"M000140-source">
1039 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
390</span>
1040 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">ls_files
</span>
1041 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">ls_files
</span>
1042 <span class=
"ruby-keyword kw">end
</span>
1048 <div id=
"method-M000123" class=
"method-detail">
1049 <a name=
"M000123"></a>
1051 <div class=
"method-heading">
1052 <a href=
"#M000123" class=
"method-signature">
1053 <span class=
"method-name">merge
</span><span class=
"method-args">(branch, message = 'merge')
</span>
1057 <div class=
"method-description">
1059 merges one or more branches into the current working branch
1062 you can specify more than one branch to merge by passing an array of
1065 <p><a class=
"source-toggle" href=
"#"
1066 onclick=
"toggleCode('M000123-source');return false;">[Source]
</a></p>
1067 <div class=
"method-source-code" id=
"M000123-source">
1069 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
290</span>
1070 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">merge
</span>(
<span class=
"ruby-identifier">branch
</span>,
<span class=
"ruby-identifier">message
</span> =
<span class=
"ruby-value str">'merge'
</span>)
1071 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">merge
</span>(
<span class=
"ruby-identifier">branch
</span>,
<span class=
"ruby-identifier">message
</span>)
1072 <span class=
"ruby-keyword kw">end
</span>
1078 <div id=
"method-M000102" class=
"method-detail">
1079 <a name=
"M000102"></a>
1081 <div class=
"method-heading">
1082 <a href=
"#M000102" class=
"method-signature">
1083 <span class=
"method-name">object
</span><span class=
"method-args">(objectish)
</span>
1087 <div class=
"method-description">
1089 returns a
<a href=
"Object.html">Git::Object
</a> of the appropriate type you
1090 can also call @git.gtree(
‘tree
’), but that
’s just for
1091 readability. If you call @git.gtree(
‘HEAD
’) it will still
1092 return a
<a href=
"Object/Commit.html">Git::Object::Commit
</a> object.
1095 @git.object calls a factory method that will run a rev-parse on the
1096 objectish and determine the type of the object and return an appropriate
1097 object for that type
1099 <p><a class=
"source-toggle" href=
"#"
1100 onclick=
"toggleCode('M000102-source');return false;">[Source]
</a></p>
1101 <div class=
"method-source-code" id=
"M000102-source">
1103 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
157</span>
1104 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">object
</span>(
<span class=
"ruby-identifier">objectish
</span>)
1105 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Object
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-identifier">objectish
</span>)
1106 <span class=
"ruby-keyword kw">end
</span>
1112 <div id=
"method-M000124" class=
"method-detail">
1113 <a name=
"M000124"></a>
1115 <div class=
"method-heading">
1116 <a href=
"#M000124" class=
"method-signature">
1117 <span class=
"method-name">pull
</span><span class=
"method-args">(remote = 'origin', branch = 'master', message = 'origin pull')
</span>
1121 <div class=
"method-description">
1123 fetches a branch from a remote and merges it into the current working
1126 <p><a class=
"source-toggle" href=
"#"
1127 onclick=
"toggleCode('M000124-source');return false;">[Source]
</a></p>
1128 <div class=
"method-source-code" id=
"M000124-source">
1130 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
295</span>
1131 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">pull
</span>(
<span class=
"ruby-identifier">remote
</span> =
<span class=
"ruby-value str">'origin'
</span>,
<span class=
"ruby-identifier">branch
</span> =
<span class=
"ruby-value str">'master'
</span>,
<span class=
"ruby-identifier">message
</span> =
<span class=
"ruby-value str">'origin pull'
</span>)
1132 <span class=
"ruby-identifier">fetch
</span>(
<span class=
"ruby-identifier">remote
</span>)
1133 <span class=
"ruby-identifier">merge
</span>(
<span class=
"ruby-identifier">branch
</span>,
<span class=
"ruby-identifier">message
</span>)
1134 <span class=
"ruby-keyword kw">end
</span>
1140 <div id=
"method-M000122" class=
"method-detail">
1141 <a name=
"M000122"></a>
1143 <div class=
"method-heading">
1144 <a href=
"#M000122" class=
"method-signature">
1145 <span class=
"method-name">push
</span><span class=
"method-args">(remote = 'origin', branch = 'master')
</span>
1149 <div class=
"method-description">
1151 pushes changes to a remote repository - easiest if this is a cloned
1152 repository, otherwise you may have to run something like this first to
1153 setup the push parameters:
1156 @git.config('remote.remote-name.push', 'refs/heads/master:refs/heads/master')
1158 <p><a class=
"source-toggle" href=
"#"
1159 onclick=
"toggleCode('M000122-source');return false;">[Source]
</a></p>
1160 <div class=
"method-source-code" id=
"M000122-source">
1162 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
283</span>
1163 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">push
</span>(
<span class=
"ruby-identifier">remote
</span> =
<span class=
"ruby-value str">'origin'
</span>,
<span class=
"ruby-identifier">branch
</span> =
<span class=
"ruby-value str">'master'
</span>)
1164 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">push
</span>(
<span class=
"ruby-identifier">remote
</span>,
<span class=
"ruby-identifier">branch
</span>)
1165 <span class=
"ruby-keyword kw">end
</span>
1171 <div id=
"method-M000135" class=
"method-detail">
1172 <a name=
"M000135"></a>
1174 <div class=
"method-heading">
1175 <a href=
"#M000135" class=
"method-signature">
1176 <span class=
"method-name">read_tree
</span><span class=
"method-args">(treeish, opts = {})
</span>
1180 <div class=
"method-description">
1181 <p><a class=
"source-toggle" href=
"#"
1182 onclick=
"toggleCode('M000135-source');return false;">[Source]
</a></p>
1183 <div class=
"method-source-code" id=
"M000135-source">
1185 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
368</span>
1186 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">read_tree
</span>(
<span class=
"ruby-identifier">treeish
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
1187 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">read_tree
</span>(
<span class=
"ruby-identifier">treeish
</span>,
<span class=
"ruby-identifier">opts
</span>)
1188 <span class=
"ruby-keyword kw">end
</span>
1194 <div id=
"method-M000110" class=
"method-detail">
1195 <a name=
"M000110"></a>
1197 <div class=
"method-heading">
1198 <a href=
"#M000110" class=
"method-signature">
1199 <span class=
"method-name">remote
</span><span class=
"method-args">(remote_name = 'origin')
</span>
1203 <div class=
"method-description">
1205 returns a
<a href=
"Remote.html">Git::Remote
</a> object
1207 <p><a class=
"source-toggle" href=
"#"
1208 onclick=
"toggleCode('M000110-source');return false;">[Source]
</a></p>
1209 <div class=
"method-source-code" id=
"M000110-source">
1211 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
194</span>
1212 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">remote
</span>(
<span class=
"ruby-identifier">remote_name
</span> =
<span class=
"ruby-value str">'origin'
</span>)
1213 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Remote
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-identifier">remote_name
</span>)
1214 <span class=
"ruby-keyword kw">end
</span>
1220 <div id=
"method-M000125" class=
"method-detail">
1221 <a name=
"M000125"></a>
1223 <div class=
"method-heading">
1224 <a href=
"#M000125" class=
"method-signature">
1225 <span class=
"method-name">remotes
</span><span class=
"method-args">()
</span>
1229 <div class=
"method-description">
1231 returns an array of
<a href=
"../Git.html">Git
</a>:
<a
1232 href=
"Remote.html">Remote
</a> objects
1234 <p><a class=
"source-toggle" href=
"#"
1235 onclick=
"toggleCode('M000125-source');return false;">[Source]
</a></p>
1236 <div class=
"method-source-code" id=
"M000125-source">
1238 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
301</span>
1239 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">remotes
</span>
1240 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">remotes
</span>.
<span class=
"ruby-identifier">map
</span> {
<span class=
"ruby-operator">|
</span><span class=
"ruby-identifier">r
</span><span class=
"ruby-operator">|
</span> <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Remote
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-identifier">r
</span>) }
1241 <span class=
"ruby-keyword kw">end
</span>
1247 <div id=
"method-M000115" class=
"method-detail">
1248 <a name=
"M000115"></a>
1250 <div class=
"method-heading">
1251 <a href=
"#M000115" class=
"method-signature">
1252 <span class=
"method-name">remove
</span><span class=
"method-args">(path = '.', opts = {})
</span>
1256 <div class=
"method-description">
1258 removes file(s) from the git repository
1260 <p><a class=
"source-toggle" href=
"#"
1261 onclick=
"toggleCode('M000115-source');return false;">[Source]
</a></p>
1262 <div class=
"method-source-code" id=
"M000115-source">
1264 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
239</span>
1265 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">remove
</span>(
<span class=
"ruby-identifier">path
</span> =
<span class=
"ruby-value str">'.'
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
1266 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">remove
</span>(
<span class=
"ruby-identifier">path
</span>,
<span class=
"ruby-identifier">opts
</span>)
1267 <span class=
"ruby-keyword kw">end
</span>
1273 <div id=
"method-M000131" class=
"method-detail">
1274 <a name=
"M000131"></a>
1276 <div class=
"method-heading">
1277 <a href=
"#M000131" class=
"method-signature">
1278 <span class=
"method-name">repack
</span><span class=
"method-args">()
</span>
1282 <div class=
"method-description">
1284 repacks the repository
1286 <p><a class=
"source-toggle" href=
"#"
1287 onclick=
"toggleCode('M000131-source');return false;">[Source]
</a></p>
1288 <div class=
"method-source-code" id=
"M000131-source">
1290 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
342</span>
1291 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">repack
</span>
1292 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">repack
</span>
1293 <span class=
"ruby-keyword kw">end
</span>
1299 <div id=
"method-M000095" class=
"method-detail">
1300 <a name=
"M000095"></a>
1302 <div class=
"method-heading">
1303 <a href=
"#M000095" class=
"method-signature">
1304 <span class=
"method-name">repo
</span><span class=
"method-args">()
</span>
1308 <div class=
"method-description">
1310 returns reference to the git repository directory
1315 <p><a class=
"source-toggle" href=
"#"
1316 onclick=
"toggleCode('M000095-source');return false;">[Source]
</a></p>
1317 <div class=
"method-source-code" id=
"M000095-source">
1319 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
86</span>
1320 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">repo
</span>
1321 <span class=
"ruby-ivar">@repository
</span>
1322 <span class=
"ruby-keyword kw">end
</span>
1328 <div id=
"method-M000100" class=
"method-detail">
1329 <a name=
"M000100"></a>
1331 <div class=
"method-heading">
1332 <a href=
"#M000100" class=
"method-signature">
1333 <span class=
"method-name">repo_size
</span><span class=
"method-args">()
</span>
1337 <div class=
"method-description">
1339 returns the repository size in bytes
1341 <p><a class=
"source-toggle" href=
"#"
1342 onclick=
"toggleCode('M000100-source');return false;">[Source]
</a></p>
1343 <div class=
"method-source-code" id=
"M000100-source">
1345 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
122</span>
1346 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">repo_size
</span>
1347 <span class=
"ruby-identifier">size
</span> =
<span class=
"ruby-value">0</span>
1348 <span class=
"ruby-constant">Dir
</span>.
<span class=
"ruby-identifier">chdir
</span>(
<span class=
"ruby-identifier">repo
</span>.
<span class=
"ruby-identifier">path
</span>)
<span class=
"ruby-keyword kw">do
</span>
1349 (
<span class=
"ruby-identifier">size
</span>,
<span class=
"ruby-identifier">dot
</span>) =
<span class=
"ruby-value">`du -d0`
</span>.
<span class=
"ruby-identifier">chomp
</span>.
<span class=
"ruby-identifier">split
</span>
1350 <span class=
"ruby-keyword kw">end
</span>
1351 <span class=
"ruby-identifier">size
</span>.
<span class=
"ruby-identifier">to_i
</span>
1352 <span class=
"ruby-keyword kw">end
</span>
1358 <div id=
"method-M000116" class=
"method-detail">
1359 <a name=
"M000116"></a>
1361 <div class=
"method-heading">
1362 <a href=
"#M000116" class=
"method-signature">
1363 <span class=
"method-name">reset
</span><span class=
"method-args">(commitish = nil, opts = {})
</span>
1367 <div class=
"method-description">
1369 resets the working directory to the provided commitish
1371 <p><a class=
"source-toggle" href=
"#"
1372 onclick=
"toggleCode('M000116-source');return false;">[Source]
</a></p>
1373 <div class=
"method-source-code" id=
"M000116-source">
1375 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
244</span>
1376 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">reset
</span>(
<span class=
"ruby-identifier">commitish
</span> =
<span class=
"ruby-keyword kw">nil
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
1377 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">reset
</span>(
<span class=
"ruby-identifier">commitish
</span>,
<span class=
"ruby-identifier">opts
</span>)
1378 <span class=
"ruby-keyword kw">end
</span>
1384 <div id=
"method-M000117" class=
"method-detail">
1385 <a name=
"M000117"></a>
1387 <div class=
"method-heading">
1388 <a href=
"#M000117" class=
"method-signature">
1389 <span class=
"method-name">reset_hard
</span><span class=
"method-args">(commitish = nil, opts = {})
</span>
1393 <div class=
"method-description">
1395 resets the working directory to the commitish with
1396 ’—hard
’
1398 <p><a class=
"source-toggle" href=
"#"
1399 onclick=
"toggleCode('M000117-source');return false;">[Source]
</a></p>
1400 <div class=
"method-source-code" id=
"M000117-source">
1402 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
249</span>
1403 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">reset_hard
</span>(
<span class=
"ruby-identifier">commitish
</span> =
<span class=
"ruby-keyword kw">nil
</span>,
<span class=
"ruby-identifier">opts
</span> = {})
1404 <span class=
"ruby-identifier">opts
</span> = {
<span class=
"ruby-identifier">:hard
</span> =
<span class=
"ruby-operator">></span> <span class=
"ruby-keyword kw">true
</span>}.
<span class=
"ruby-identifier">merge
</span>(
<span class=
"ruby-identifier">opts
</span>)
1405 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">reset
</span>(
<span class=
"ruby-identifier">commitish
</span>,
<span class=
"ruby-identifier">opts
</span>)
1406 <span class=
"ruby-keyword kw">end
</span>
1412 <div id=
"method-M000143" class=
"method-detail">
1413 <a name=
"M000143"></a>
1415 <div class=
"method-heading">
1416 <a href=
"#M000143" class=
"method-signature">
1417 <span class=
"method-name">revparse
</span><span class=
"method-args">(objectish)
</span>
1421 <div class=
"method-description">
1423 runs git rev-parse to convert the objectish to a full sha
1426 @git.revparse(
"HEAD^^
")
1427 @git.revparse('v2.4^{tree}')
1428 @git.revparse('v2.4:/doc/index.html')
1430 <p><a class=
"source-toggle" href=
"#"
1431 onclick=
"toggleCode('M000143-source');return false;">[Source]
</a></p>
1432 <div class=
"method-source-code" id=
"M000143-source">
1434 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
420</span>
1435 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">revparse
</span>(
<span class=
"ruby-identifier">objectish
</span>)
1436 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">revparse
</span>(
<span class=
"ruby-identifier">objectish
</span>)
1437 <span class=
"ruby-keyword kw">end
</span>
1443 <div id=
"method-M000098" class=
"method-detail">
1444 <a name=
"M000098"></a>
1446 <div class=
"method-heading">
1447 <a href=
"#M000098" class=
"method-signature">
1448 <span class=
"method-name">set_index
</span><span class=
"method-args">(index_file, check = true)
</span>
1452 <div class=
"method-description">
1453 <p><a class=
"source-toggle" href=
"#"
1454 onclick=
"toggleCode('M000098-source');return false;">[Source]
</a></p>
1455 <div class=
"method-source-code" id=
"M000098-source">
1457 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
101</span>
1458 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">set_index
</span>(
<span class=
"ruby-identifier">index_file
</span>,
<span class=
"ruby-identifier">check
</span> =
<span class=
"ruby-keyword kw">true
</span>)
1459 <span class=
"ruby-ivar">@lib
</span> =
<span class=
"ruby-keyword kw">nil
</span>
1460 <span class=
"ruby-ivar">@index
</span> =
<span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Index
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">index_file
</span>.
<span class=
"ruby-identifier">to_s
</span>,
<span class=
"ruby-identifier">check
</span>)
1461 <span class=
"ruby-keyword kw">end
</span>
1467 <div id=
"method-M000097" class=
"method-detail">
1468 <a name=
"M000097"></a>
1470 <div class=
"method-heading">
1471 <a href=
"#M000097" class=
"method-signature">
1472 <span class=
"method-name">set_working
</span><span class=
"method-args">(work_dir, check = true)
</span>
1476 <div class=
"method-description">
1477 <p><a class=
"source-toggle" href=
"#"
1478 onclick=
"toggleCode('M000097-source');return false;">[Source]
</a></p>
1479 <div class=
"method-source-code" id=
"M000097-source">
1481 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
96</span>
1482 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">set_working
</span>(
<span class=
"ruby-identifier">work_dir
</span>,
<span class=
"ruby-identifier">check
</span> =
<span class=
"ruby-keyword kw">true
</span>)
1483 <span class=
"ruby-ivar">@lib
</span> =
<span class=
"ruby-keyword kw">nil
</span>
1484 <span class=
"ruby-ivar">@working_directory
</span> =
<span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">WorkingDirectory
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-identifier">work_dir
</span>.
<span class=
"ruby-identifier">to_s
</span>,
<span class=
"ruby-identifier">check
</span>)
1485 <span class=
"ruby-keyword kw">end
</span>
1491 <div id=
"method-M000107" class=
"method-detail">
1492 <a name=
"M000107"></a>
1494 <div class=
"method-heading">
1495 <a href=
"#M000107" class=
"method-signature">
1496 <span class=
"method-name">status
</span><span class=
"method-args">()
</span>
1500 <div class=
"method-description">
1502 returns a
<a href=
"Status.html">Git::Status
</a> object
1504 <p><a class=
"source-toggle" href=
"#"
1505 onclick=
"toggleCode('M000107-source');return false;">[Source]
</a></p>
1506 <div class=
"method-source-code" id=
"M000107-source">
1508 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
179</span>
1509 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">status
</span>
1510 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Status
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>)
1511 <span class=
"ruby-keyword kw">end
</span>
1517 <div id=
"method-M000128" class=
"method-detail">
1518 <a name=
"M000128"></a>
1520 <div class=
"method-heading">
1521 <a href=
"#M000128" class=
"method-signature">
1522 <span class=
"method-name">tag
</span><span class=
"method-args">(tag_name)
</span>
1526 <div class=
"method-description">
1528 returns a Git::Tag object
1530 <p><a class=
"source-toggle" href=
"#"
1531 onclick=
"toggleCode('M000128-source');return false;">[Source]
</a></p>
1532 <div class=
"method-source-code" id=
"M000128-source">
1534 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
326</span>
1535 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">tag
</span>(
<span class=
"ruby-identifier">tag_name
</span>)
1536 <span class=
"ruby-constant">Git
</span><span class=
"ruby-operator">::
</span><span class=
"ruby-constant">Object
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-keyword kw">self
</span>,
<span class=
"ruby-identifier">tag_name
</span>,
<span class=
"ruby-value str">'tag'
</span>,
<span class=
"ruby-keyword kw">true
</span>)
1537 <span class=
"ruby-keyword kw">end
</span>
1543 <div id=
"method-M000127" class=
"method-detail">
1544 <a name=
"M000127"></a>
1546 <div class=
"method-heading">
1547 <a href=
"#M000127" class=
"method-signature">
1548 <span class=
"method-name">tags
</span><span class=
"method-args">()
</span>
1552 <div class=
"method-description">
1554 returns an array of all Git::Tag objects for this repository
1556 <p><a class=
"source-toggle" href=
"#"
1557 onclick=
"toggleCode('M000127-source');return false;">[Source]
</a></p>
1558 <div class=
"method-source-code" id=
"M000127-source">
1560 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
321</span>
1561 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">tags
</span>
1562 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">tags
</span>.
<span class=
"ruby-identifier">map
</span> {
<span class=
"ruby-operator">|
</span><span class=
"ruby-identifier">r
</span><span class=
"ruby-operator">|
</span> <span class=
"ruby-identifier">tag
</span>(
<span class=
"ruby-identifier">r
</span>) }
1563 <span class=
"ruby-keyword kw">end
</span>
1569 <div id=
"method-M000139" class=
"method-detail">
1570 <a name=
"M000139"></a>
1572 <div class=
"method-heading">
1573 <a href=
"#M000139" class=
"method-signature">
1574 <span class=
"method-name">update_ref
</span><span class=
"method-args">(branch, commit)
</span>
1578 <div class=
"method-description">
1579 <p><a class=
"source-toggle" href=
"#"
1580 onclick=
"toggleCode('M000139-source');return false;">[Source]
</a></p>
1581 <div class=
"method-source-code" id=
"M000139-source">
1583 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
385</span>
1584 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">update_ref
</span>(
<span class=
"ruby-identifier">branch
</span>,
<span class=
"ruby-identifier">commit
</span>)
1585 <span class=
"ruby-identifier">branch
</span>(
<span class=
"ruby-identifier">branch
</span>).
<span class=
"ruby-identifier">update_ref
</span>(
<span class=
"ruby-identifier">commit
</span>)
1586 <span class=
"ruby-keyword kw">end
</span>
1592 <div id=
"method-M000132" class=
"method-detail">
1593 <a name=
"M000132"></a>
1595 <div class=
"method-heading">
1596 <a href=
"#M000132" class=
"method-signature">
1597 <span class=
"method-name">with_index
</span><span class=
"method-args">(new_index) {|@index| ...}
</span>
1601 <div class=
"method-description">
1603 LOWER LEVEL INDEX OPERATIONS ##
1605 <p><a class=
"source-toggle" href=
"#"
1606 onclick=
"toggleCode('M000132-source');return false;">[Source]
</a></p>
1607 <div class=
"method-source-code" id=
"M000132-source">
1609 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
349</span>
1610 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">with_index
</span>(
<span class=
"ruby-identifier">new_index
</span>)
1611 <span class=
"ruby-identifier">old_index
</span> =
<span class=
"ruby-ivar">@index
</span>
1612 <span class=
"ruby-identifier">set_index
</span>(
<span class=
"ruby-identifier">new_index
</span>,
<span class=
"ruby-keyword kw">false
</span>)
1613 <span class=
"ruby-identifier">return_value
</span> =
<span class=
"ruby-keyword kw">yield
</span> <span class=
"ruby-ivar">@index
</span>
1614 <span class=
"ruby-identifier">set_index
</span>(
<span class=
"ruby-identifier">old_index
</span>)
1615 <span class=
"ruby-identifier">return_value
</span>
1616 <span class=
"ruby-keyword kw">end
</span>
1622 <div id=
"method-M000133" class=
"method-detail">
1623 <a name=
"M000133"></a>
1625 <div class=
"method-heading">
1626 <a href=
"#M000133" class=
"method-signature">
1627 <span class=
"method-name">with_temp_index
</span><span class=
"method-args">(
&blk)
</span>
1631 <div class=
"method-description">
1632 <p><a class=
"source-toggle" href=
"#"
1633 onclick=
"toggleCode('M000133-source');return false;">[Source]
</a></p>
1634 <div class=
"method-source-code" id=
"M000133-source">
1636 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
357</span>
1637 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">with_temp_index
</span> <span class=
"ruby-operator">&</span><span class=
"ruby-identifier">blk
</span>
1638 <span class=
"ruby-identifier">tempfile
</span> =
<span class=
"ruby-constant">Tempfile
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-value str">'temp-index'
</span>)
1639 <span class=
"ruby-identifier">temp_path
</span> =
<span class=
"ruby-identifier">tempfile
</span>.
<span class=
"ruby-identifier">path
</span>
1640 <span class=
"ruby-identifier">tempfile
</span>.
<span class=
"ruby-identifier">unlink
</span>
1641 <span class=
"ruby-identifier">with_index
</span>(
<span class=
"ruby-identifier">temp_path
</span>,
<span class=
"ruby-operator">&</span><span class=
"ruby-identifier">blk
</span>)
1642 <span class=
"ruby-keyword kw">end
</span>
1648 <div id=
"method-M000142" class=
"method-detail">
1649 <a name=
"M000142"></a>
1651 <div class=
"method-heading">
1652 <a href=
"#M000142" class=
"method-signature">
1653 <span class=
"method-name">with_temp_working
</span><span class=
"method-args">(
&blk)
</span>
1657 <div class=
"method-description">
1658 <p><a class=
"source-toggle" href=
"#"
1659 onclick=
"toggleCode('M000142-source');return false;">[Source]
</a></p>
1660 <div class=
"method-source-code" id=
"M000142-source">
1662 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
405</span>
1663 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">with_temp_working
</span> <span class=
"ruby-operator">&</span><span class=
"ruby-identifier">blk
</span>
1664 <span class=
"ruby-identifier">tempfile
</span> =
<span class=
"ruby-constant">Tempfile
</span>.
<span class=
"ruby-identifier">new
</span>(
<span class=
"ruby-value str">"temp-workdir
"</span>)
1665 <span class=
"ruby-identifier">temp_dir
</span> =
<span class=
"ruby-identifier">tempfile
</span>.
<span class=
"ruby-identifier">path
</span>
1666 <span class=
"ruby-identifier">tempfile
</span>.
<span class=
"ruby-identifier">unlink
</span>
1667 <span class=
"ruby-constant">Dir
</span>.
<span class=
"ruby-identifier">mkdir
</span>(
<span class=
"ruby-identifier">temp_dir
</span>,
<span class=
"ruby-value">0700</span>)
1668 <span class=
"ruby-identifier">with_working
</span>(
<span class=
"ruby-identifier">temp_dir
</span>,
<span class=
"ruby-operator">&</span><span class=
"ruby-identifier">blk
</span>)
1669 <span class=
"ruby-keyword kw">end
</span>
1675 <div id=
"method-M000141" class=
"method-detail">
1676 <a name=
"M000141"></a>
1678 <div class=
"method-heading">
1679 <a href=
"#M000141" class=
"method-signature">
1680 <span class=
"method-name">with_working
</span><span class=
"method-args">(work_dir) {|@working_directory| ...}
</span>
1684 <div class=
"method-description">
1685 <p><a class=
"source-toggle" href=
"#"
1686 onclick=
"toggleCode('M000141-source');return false;">[Source]
</a></p>
1687 <div class=
"method-source-code" id=
"M000141-source">
1689 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
394</span>
1690 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">with_working
</span>(
<span class=
"ruby-identifier">work_dir
</span>)
1691 <span class=
"ruby-identifier">return_value
</span> =
<span class=
"ruby-keyword kw">false
</span>
1692 <span class=
"ruby-identifier">old_working
</span> =
<span class=
"ruby-ivar">@working_directory
</span>
1693 <span class=
"ruby-identifier">set_working
</span>(
<span class=
"ruby-identifier">work_dir
</span>)
1694 <span class=
"ruby-constant">Dir
</span>.
<span class=
"ruby-identifier">chdir
</span> <span class=
"ruby-identifier">work_dir
</span> <span class=
"ruby-keyword kw">do
</span>
1695 <span class=
"ruby-identifier">return_value
</span> =
<span class=
"ruby-keyword kw">yield
</span> <span class=
"ruby-ivar">@working_directory
</span>
1696 <span class=
"ruby-keyword kw">end
</span>
1697 <span class=
"ruby-identifier">set_working
</span>(
<span class=
"ruby-identifier">old_working
</span>)
1698 <span class=
"ruby-identifier">return_value
</span>
1699 <span class=
"ruby-keyword kw">end
</span>
1705 <div id=
"method-M000138" class=
"method-detail">
1706 <a name=
"M000138"></a>
1708 <div class=
"method-heading">
1709 <a href=
"#M000138" class=
"method-signature">
1710 <span class=
"method-name">write_and_commit_tree
</span><span class=
"method-args">(opts = {})
</span>
1714 <div class=
"method-description">
1715 <p><a class=
"source-toggle" href=
"#"
1716 onclick=
"toggleCode('M000138-source');return false;">[Source]
</a></p>
1717 <div class=
"method-source-code" id=
"M000138-source">
1719 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
380</span>
1720 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">write_and_commit_tree
</span>(
<span class=
"ruby-identifier">opts
</span> = {})
1721 <span class=
"ruby-identifier">tree
</span> =
<span class=
"ruby-identifier">write_tree
</span>
1722 <span class=
"ruby-identifier">commit_tree
</span>(
<span class=
"ruby-identifier">tree
</span>,
<span class=
"ruby-identifier">opts
</span>)
1723 <span class=
"ruby-keyword kw">end
</span>
1729 <div id=
"method-M000136" class=
"method-detail">
1730 <a name=
"M000136"></a>
1732 <div class=
"method-heading">
1733 <a href=
"#M000136" class=
"method-signature">
1734 <span class=
"method-name">write_tree
</span><span class=
"method-args">()
</span>
1738 <div class=
"method-description">
1739 <p><a class=
"source-toggle" href=
"#"
1740 onclick=
"toggleCode('M000136-source');return false;">[Source]
</a></p>
1741 <div class=
"method-source-code" id=
"M000136-source">
1743 <span class=
"ruby-comment cmt"># File lib/git/base.rb, line
372</span>
1744 <span class=
"ruby-keyword kw">def
</span> <span class=
"ruby-identifier">write_tree
</span>
1745 <span class=
"ruby-keyword kw">self
</span>.
<span class=
"ruby-identifier">lib
</span>.
<span class=
"ruby-identifier">write_tree
</span>
1746 <span class=
"ruby-keyword kw">end
</span>
1759 <div id=
"validator-badges">
1760 <p><small><a href=
"http://validator.w3.org/check/referer">[Validate]
</a></small></p>