summaryrefslogtreecommitdiffstats
path: root/doc/files/EXAMPLES.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/files/EXAMPLES.html')
-rw-r--r--doc/files/EXAMPLES.html268
1 files changed, 268 insertions, 0 deletions
diff --git a/doc/files/EXAMPLES.html b/doc/files/EXAMPLES.html
new file mode 100644
index 0000000..ef92243
--- /dev/null
+++ b/doc/files/EXAMPLES.html
@@ -0,0 +1,268 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: EXAMPLES</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>EXAMPLES</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>EXAMPLES
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Sun Nov 11 17:51:57 PST 2007</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+require &#8216;git&#8217;
+</p>
+<p>
+# needs read permission only
+</p>
+<p>
+g = <a href="../classes/Git.html#M000002">Git.open</a> (working_dir =
+&#8217;.&#8217;)
+</p>
+<pre>
+ (git_dir, index_file)
+</pre>
+<p>
+g.index g.index.readable? g.index.writable? g.repo g.dir
+</p>
+<p>
+g.log # returns array of Git::Commit objects g.log.since(&#8216;2 weeks
+ago&#8217;) g.log.between(&#8216;v2.5&#8217;, &#8216;v2.6&#8217;)
+g.log.each {|l| puts l.sha }
+g.gblob(&#8216;v2.5:Makefile&#8217;).log.since(&#8216;2 weeks ago&#8217;)
+</p>
+<p>
+g.object(&#8216;HEAD^&#8217;).to_s # git show / git rev-parse
+g.object(&#8216;HEAD^&#8217;).contents
+g.object(&#8216;v2.5:Makefile&#8217;).size
+g.object(&#8216;v2.5:Makefile&#8217;).sha
+</p>
+<p>
+g.gtree(treeish) g.gblob(treeish) g.gcommit(treeish)
+</p>
+<p>
+g.revparse(&#8216;v2.5:Makefile&#8217;)
+</p>
+<p>
+g.branches # returns <a href="../classes/Git/Branch.html">Git::Branch</a>
+objects g.branches.local g.branches.remote g.branches[:master].gcommit
+g.branches[&#8216;origin/master&#8217;].gcommit
+</p>
+<p>
+g.grep(&#8216;hello&#8217;) # implies HEAD
+g.blob(&#8216;v2.5:Makefile&#8217;).grep(&#8216;hello&#8217;)
+g.tag(&#8216;v2.5&#8217;).grep(&#8216;hello&#8217;, &#8216;docs/&#8217;)
+</p>
+<p>
+g.diff(commit1, commit2).size g.diff(commit1, commit2).stats
+g.gtree(&#8216;v2.5&#8217;).diff(&#8216;v2.6&#8217;).insertions
+g.diff(&#8216;gitsearch1&#8217;,
+&#8216;v2.5&#8217;).path(&#8216;lib/&#8217;)
+g.diff(&#8216;gitsearch1&#8217;, @git.gtree(&#8216;v2.5&#8217;))
+g.diff(&#8216;gitsearch1&#8217;,
+&#8216;v2.5&#8217;).path(&#8216;docs/&#8217;).patch
+g.gtree(&#8216;v2.5&#8217;).diff(&#8216;v2.6&#8217;).patch
+</p>
+<p>
+g.gtree(&#8216;v2.5&#8217;).diff(&#8216;v2.6&#8217;).each do |file_diff|
+</p>
+<pre>
+ puts file_diff.path
+ puts file_diff.patch
+ puts file_diff.blob(:src).contents
+</pre>
+<p>
+end
+</p>
+<p>
+g.config(&#8216;user.name&#8217;) # returns &#8216;Scott Chacon&#8217;
+g.config # returns whole config hash
+</p>
+<p>
+g.tag # returns array of Git::Tag objects
+</p>
+<p>
+# needs write permission
+</p>
+<p>
+g = <a href="../classes/Git.html#M000003">Git.init</a>
+</p>
+<pre>
+ Git.init('project')
+ Git.init('/home/schacon/proj',
+ { :git_dir =&gt; '/opt/git/proj.git',
+ :index_file =&gt; '/tmp/index'} )
+</pre>
+<p>
+g = <a href="../classes/Git.html#M000004">Git.clone</a>(URI, :name =&gt;
+&#8216;name&#8217;, :path =&gt; &#8217;/tmp/checkout&#8216;
+</p>
+<pre>
+ (git_dir, index_file)
+</pre>
+<p>
+g.config(&#8216;user.name&#8217;, &#8216;Scott Chacon&#8217;)
+g.config(&#8216;user.email&#8217;, &#8216;email@email.com&#8217;)
+</p>
+<p>
+g.add(&#8217;.&#8217;) g.add([file1, file2])
+</p>
+<p>
+g.remove(&#8216;file.txt&#8217;) g.remove([&#8216;file.txt&#8217;,
+&#8216;file2.txt&#8217;])
+</p>
+<p>
+g.commit(&#8216;message&#8217;) g.commit_all(&#8216;message&#8217;)
+</p>
+<p>
+g = <a href="../classes/Git.html#M000004">Git.clone</a>(repo,
+&#8216;myrepo&#8217;) Dir.chdir(&#8216;myrepo&#8217;) do
+</p>
+<pre>
+ new_file('test-file', 'blahblahblah')
+ g.status.untracked.each do |file|
+ puts file.blob(:index).contents
+ end
+</pre>
+<p>
+end
+</p>
+<p>
+g.reset # defaults to HEAD g.reset_hard(Git::Commit)
+</p>
+<p>
+g.branch(&#8216;new_branch&#8217;) # creates new or fetches existing
+g.branch(&#8216;new_branch&#8217;).checkout
+g.branch(&#8216;new_branch&#8217;).delete
+g.branch(&#8216;existing_branch&#8217;).checkout
+</p>
+<p>
+g.checkout(&#8216;new_branch&#8217;)
+g.checkout(g.branch(&#8216;new_branch&#8217;))
+</p>
+<p>
+g.branch(name).merge(branch2) g.branch(branch2).merge # merges HEAD with
+branch2
+</p>
+<p>
+g.branch(name).in_branch(message) { # add files } # auto-commits
+g.merge(&#8216;new_branch&#8217;)
+g.merge(&#8216;origin/remote_branch&#8217;)
+g.merge(b.branch(&#8216;master&#8217;)) g.merge([branch1, branch2])
+</p>
+<p>
+r = g.add_remote(name, uri) # <a
+href="../classes/Git/Remote.html">Git::Remote</a> r = g.add_remote(name, <a
+href="../classes/Git/Base.html">Git::Base</a>) # <a
+href="../classes/Git/Remote.html">Git::Remote</a>
+</p>
+<p>
+g.remotes # array of Git::Remotes g.remote(name).fetch
+g.remote(name).remove g.remote(name).merge g.remote(name).merge(branch)
+</p>
+<p>
+g.fetch g.fetch(g.remotes.first)
+</p>
+<p>
+g.pull g.pull(Git::Repo, <a
+href="../classes/Git/Branch.html">Git::Branch</a>) # fetch and a merge
+</p>
+<p>
+g.add_tag(&#8216;tag_name&#8217;) # returns Git::Tag
+</p>
+<p>
+g.repack
+</p>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html> \ No newline at end of file