File tree 1 file changed +5
-10
lines changed
1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -39,19 +39,20 @@ like:
39
39
40
40
Here are a bunch of examples of how to use the Ruby/Git package.
41
41
42
- First you have to remember to require rubygems if it's not. Then include the 'git' gem.
42
+ Ruby < 1.9 will require rubygems to be loaded.
43
43
44
44
``` ruby
45
-
46
45
require ' rubygems'
47
- require ' git '
46
+ ```
48
47
48
+ Require the 'git' gem.
49
+ ``` ruby
50
+ require ' git'
49
51
```
50
52
51
53
Here are the operations that need read permission only.
52
54
53
55
``` ruby
54
-
55
56
g = Git .open (working_dir, :log => Logger .new (STDOUT ))
56
57
57
58
g.index
@@ -124,13 +125,11 @@ Here are the operations that need read permission only.
124
125
g.config # returns whole config hash
125
126
126
127
g.tag # returns array of Git::Tag objects
127
-
128
128
```
129
129
130
130
And here are the operations that will need to write to your git repository.
131
131
132
132
``` ruby
133
-
134
133
g = Git .init
135
134
Git .init(' project' )
136
135
Git .init(' /home/schacon/proj' ,
@@ -199,13 +198,11 @@ And here are the operations that will need to write to your git repository.
199
198
200
199
g.push
201
200
g.push(g.remote(' name' ))
202
-
203
201
```
204
202
205
203
Some examples of more low-level index and tree operations
206
204
207
205
``` ruby
208
-
209
206
g.with_temp_index do
210
207
211
208
g.read_tree(tree3) # calls self.index.read_tree
@@ -242,10 +239,8 @@ Some examples of more low-level index and tree operations
242
239
# do file work
243
240
g.commit # commits to index
244
241
end
245
-
246
242
```
247
243
248
-
249
244
## License
250
245
251
246
licensed under MIT License Copyright (c) 2008 Scott Chacon. See LICENSE for further details.
You can’t perform that action at this time.
0 commit comments