From bc60052b519b8b991e50b8ccb30f2b76ad125996 Mon Sep 17 00:00:00 2001 From: scott Chacon Date: Fri, 16 Nov 2007 13:24:30 -0800 Subject: updated the docs --- doc/files/README.html | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'doc/files/README.html') diff --git a/doc/files/README.html b/doc/files/README.html index 69d8471..8776a1a 100644 --- a/doc/files/README.html +++ b/doc/files/README.html @@ -56,7 +56,7 @@ Last Update: - Tue Nov 13 08:54:36 PST 2007 + Fri Nov 16 11:43:31 PST 2007 @@ -305,6 +305,46 @@ And here are the operations that will need to write to your git repository. g.push g.push(g.remote('name')) +

+Some examples of more low-level index and tree operations +

+
+   g.with_temp_index do
+
+     g.read_tree(tree3) # calls self.index.read_tree
+     g.read_tree(tree1, :prefix => 'hi/')
+
+     c = g.commit_tree('message')
+     # or #
+     t = g.write_tree
+     c = g.commit_tree(t, :message => 'message', :parents => [sha1, sha2])
+
+     g.branch('branch_name').update_ref(c)
+     g.update_ref(branch, c)
+
+     g.with_temp_working do # new blank working directory
+       g.checkout
+       g.checkout(another_index)
+       g.commit # commits to temp_index
+     end
+   end
+
+   g.set_index('/path/to/index')
+
+   g.with_index(path) do
+     # calls set_index, then switches back after
+   end
+
+   g.with_working(dir) do
+   # calls set_working, then switches back after
+   end
+
+   g.with_temp_working(dir) do
+     g.checkout_index(:prefix => dir, :path_limiter => path)
+     # do file work
+     g.commit # commits to index
+   end
+
-- cgit