Skip to content

Commit 8e9c17e

Browse files
committed
docs(README): add Manager/Cmd pattern examples
why: Showcase the new typed Python API for git subcommands. what: - Add "Manage Branches, Tags, and More" section - Show examples for branches, tags, and remotes - Link to full Manager/Cmd documentation
1 parent 5acef2b commit 8e9c17e

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,31 @@ git.clone(url='https://github.com/vcs-python/libvcs.git')
9191
Above: [`libvcs.cmd.git.Git`](https://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.Git) using
9292
[`Git.clone()`](http://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.Git.clone).
9393

94+
### Manage Branches, Tags, and More
95+
96+
Work with git subcommands using typed Python objects:
97+
98+
```python
99+
from libvcs.cmd.git import Git
100+
101+
git = Git(path='/path/to/repo')
102+
103+
# Branches
104+
branches = git.branches.ls() # List all branches
105+
git.branches.create('feature-branch') # Create a branch
106+
107+
# Tags
108+
git.tags.create(name='v1.0.0', message='Release')
109+
tags = git.tags.ls()
110+
111+
# Remotes
112+
remotes = git.remotes.ls()
113+
remote = git.remotes.get(remote_name='origin')
114+
remote.prune()
115+
```
116+
117+
See the [Manager/Cmd pattern documentation](https://libvcs.git-pull.com/cmd/git/index.html) for more.
118+
94119
## Repository Synchronization
95120

96121
Synchronize your repositories using the

0 commit comments

Comments
 (0)