Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In this example we run `git init` on a directory, add a *.gitignore*,
and commit it.

``` python
import tempfile
import shutil, tempfile
```

``` python
Expand All @@ -34,11 +34,23 @@ def _git_init(g):
```

``` python
with tempfile.TemporaryDirectory() as td:
g = Git(td)
_git_init(g)
assert 'add .gitignore' in g.last_commit
print(g.branch('--show-current'))
td = tempfile.mkdtemp()
g = Git(td)
_git_init(g)
assert 'add .gitignore' in g.last_commit
print(g.branch('--show-current'))
```

main

You can also pass path arguments after `--` using the `__` parameter:

``` python
g.log('--oneline', __=['.gitignore'])
```

'22a9a5d add .gitignore'

``` python
shutil.rmtree(td)
```
51 changes: 45 additions & 6 deletions nbs/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"metadata": {},
"outputs": [],
"source": [
"import tempfile"
"import shutil, tempfile"
]
},
{
Expand Down Expand Up @@ -109,11 +109,50 @@
}
],
"source": [
"with tempfile.TemporaryDirectory() as td:\n",
" g = Git(td)\n",
" _git_init(g)\n",
" assert 'add .gitignore' in g.last_commit\n",
" print(g.branch('--show-current'))"
"td = tempfile.mkdtemp()\n",
"g = Git(td)\n",
"_git_init(g)\n",
"assert 'add .gitignore' in g.last_commit\n",
"print(g.branch('--show-current'))"
]
},
{
"cell_type": "markdown",
"id": "306619e8",
"metadata": {},
"source": [
"You can also pass path arguments after `--` using the `__` parameter:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "32a5a2af",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'22a9a5d add .gitignore'"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"g.log('--oneline', __=['.gitignore'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aff78522",
"metadata": {},
"outputs": [],
"source": [
"shutil.rmtree(td)"
]
}
],
Expand Down