Skip to content

Commit 8846587

Browse files
author
scott Chacon
committed
added some examples to the README
1 parent 3c1b3f0 commit 8846587

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,28 @@ And here are the operations that will need to write to your git repository.
204204

205205
g.push
206206
g.push(g.remote('name'))
207+
208+
209+
Some examples of more low-level index and tree operations
210+
211+
g.with_temp_index do
212+
213+
g.read_tree(tree3) # calls self.index.read_tree
214+
g.read_tree(tree1, :prefix => 'hi/')
215+
216+
c = g.commit_tree('message')
217+
# or #
218+
t = g.write_tree
219+
c = g.commit_tree(t, :message => 'message', :parents => [sha1, sha2])
220+
221+
g.branch('branch_name').update_ref(c)
222+
g.update_ref(branch, c)
223+
224+
g.with_temp_working do # new blank working directory
225+
g.checkout
226+
g.checkout(another_index)
227+
g.commit # commits to temp_index
228+
end
229+
end
230+
231+
g.set_index('/path/to/index')

0 commit comments

Comments
 (0)