Skip to content

Commit 1da4f41

Browse files
committed
update -- docs
1 parent 2612796 commit 1da4f41

File tree

2 files changed

+63
-12
lines changed

2 files changed

+63
-12
lines changed

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In this example we run `git init` on a directory, add a *.gitignore*,
1919
and commit it.
2020

2121
``` python
22-
import tempfile
22+
import shutil, tempfile
2323
```
2424

2525
``` python
@@ -34,11 +34,23 @@ def _git_init(g):
3434
```
3535

3636
``` python
37-
with tempfile.TemporaryDirectory() as td:
38-
g = Git(td)
39-
_git_init(g)
40-
assert 'add .gitignore' in g.last_commit
41-
print(g.branch('--show-current'))
37+
td = tempfile.mkdtemp()
38+
g = Git(td)
39+
_git_init(g)
40+
assert 'add .gitignore' in g.last_commit
41+
print(g.branch('--show-current'))
4242
```
4343

4444
main
45+
46+
You can also pass path arguments after `--` using the `__` parameter:
47+
48+
``` python
49+
g.log('--oneline', __=['.gitignore'])
50+
```
51+
52+
'22a9a5d add .gitignore'
53+
54+
``` python
55+
shutil.rmtree(td)
56+
```

nbs/index.ipynb

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"metadata": {},
7575
"outputs": [],
7676
"source": [
77-
"import tempfile"
77+
"import shutil, tempfile"
7878
]
7979
},
8080
{
@@ -109,11 +109,50 @@
109109
}
110110
],
111111
"source": [
112-
"with tempfile.TemporaryDirectory() as td:\n",
113-
" g = Git(td)\n",
114-
" _git_init(g)\n",
115-
" assert 'add .gitignore' in g.last_commit\n",
116-
" print(g.branch('--show-current'))"
112+
"td = tempfile.mkdtemp()\n",
113+
"g = Git(td)\n",
114+
"_git_init(g)\n",
115+
"assert 'add .gitignore' in g.last_commit\n",
116+
"print(g.branch('--show-current'))"
117+
]
118+
},
119+
{
120+
"cell_type": "markdown",
121+
"id": "306619e8",
122+
"metadata": {},
123+
"source": [
124+
"You can also pass path arguments after `--` using the `__` parameter:"
125+
]
126+
},
127+
{
128+
"cell_type": "code",
129+
"execution_count": null,
130+
"id": "32a5a2af",
131+
"metadata": {},
132+
"outputs": [
133+
{
134+
"data": {
135+
"text/plain": [
136+
"'22a9a5d add .gitignore'"
137+
]
138+
},
139+
"execution_count": null,
140+
"metadata": {},
141+
"output_type": "execute_result"
142+
}
143+
],
144+
"source": [
145+
"g.log('--oneline', __=['.gitignore'])"
146+
]
147+
},
148+
{
149+
"cell_type": "code",
150+
"execution_count": null,
151+
"id": "aff78522",
152+
"metadata": {},
153+
"outputs": [],
154+
"source": [
155+
"shutil.rmtree(td)"
117156
]
118157
}
119158
],

0 commit comments

Comments
 (0)