@robinpath/git
0.1.1Node.jsPublicGit version control operations using the system git binary
Git
Git version control operations using the system git binary
Package: @robinpath/git | Category: Devops | Type: Integration
Authentication
No authentication required. All functions are available immediately.
Use Cases
Use the git module when you need to:
- Clone a git repository -- Use
git.cloneto perform this operation - Initialize a new git repository -- Use
git.initto perform this operation - Get the working tree status -- Use
git.statusto perform this operation - Stage files for commit -- Use
git.addto perform this operation - Create a commit with the staged changes -- Use
git.committo perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
clone | Clone a git repository | object |
init | Initialize a new git repository | object |
status | Get the working tree status | object |
add | Stage files for commit | object |
commit | Create a commit with the staged changes | object |
push | Push commits to a remote repository | object |
pull | Pull changes from a remote repository | object |
branch | List, create, or delete branches | object |
checkout | Switch branches or restore working tree files | object |
log | Show the commit log | object |
diff | Show changes between commits, working tree, etc. | object |
tag | Create or list tags | object |
remote | List remote repositories | object |
merge | Merge a branch into the current branch | object |
stash | Stash or restore uncommitted changes | object |
reset | Reset the current HEAD to a specified state | object |
Functions
clone
Clone a git repository
Module: git | Returns: object -- API response.
git.clone
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Repository URL to clone |
dest | string | No | Destination directory |
cwd | string | No | Working directory |
init
Initialize a new git repository
Module: git | Returns: object -- API response.
git.init
| Parameter | Type | Required | Description |
|---|---|---|---|
cwd | string | No | Directory to initialize |
bare | boolean | No | Create a bare repository |
status
Get the working tree status
Module: git | Returns: object -- API response.
git.status
| Parameter | Type | Required | Description |
|---|---|---|---|
cwd | string | No | Repository path |
short | boolean | No | Show short status |
add
Stage files for commit
Module: git | Returns: object -- API response.
git.add
| Parameter | Type | Required | Description |
|---|---|---|---|
files | `string | string[]` | Yes |
cwd | string | No | Repository path |
commit
Create a commit with the staged changes
Module: git | Returns: object -- API response.
git.commit
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Commit message |
cwd | string | No | Repository path |
amend | boolean | No | Amend the previous commit |
push
Push commits to a remote repository
Module: git | Returns: object -- API response.
git.push
| Parameter | Type | Required | Description |
|---|---|---|---|
cwd | string | No | Repository path |
remote | string | No | Remote name (default: origin) |
branch | string | No | Branch to push |
force | boolean | No | Force push |
pull
Pull changes from a remote repository
Module: git | Returns: object -- API response.
git.pull
| Parameter | Type | Required | Description |
|---|---|---|---|
cwd | string | No | Repository path |
remote | string | No | Remote name (default: origin) |
branch | string | No | Branch to pull |
rebase | boolean | No | Rebase instead of merge |
branch
List, create, or delete branches
Module: git | Returns: object -- API response.
git.branch
| Parameter | Type | Required | Description |
|---|---|---|---|
cwd | string | No | Repository path |
name | string | No | Branch name to create (omit to list) |
deleteBranch | boolean | No | Delete the named branch |
checkout
Switch branches or restore working tree files
Module: git | Returns: object -- API response.
git.checkout
| Parameter | Type | Required | Description |
|---|---|---|---|
target | string | Yes | Branch or commit to checkout |
cwd | string | No | Repository path |
create | boolean | No | Create a new branch |
log
Show the commit log
Module: git | Returns: object -- API response.
git.log
| Parameter | Type | Required | Description |
|---|---|---|---|
cwd | string | No | Repository path |
count | number | No | Number of commits to show (default: 10) |
oneline | boolean | No | One line per commit (default: true) |
diff
Show changes between commits, working tree, etc.
Module: git | Returns: object -- API response.
git.diff
| Parameter | Type | Required | Description |
|---|---|---|---|
cwd | string | No | Repository path |
staged | boolean | No | Show staged changes |
ref | string | No | Reference to diff against |
tag
Create or list tags
Module: git | Returns: object -- API response.
git.tag
| Parameter | Type | Required | Description |
|---|---|---|---|
cwd | string | No | Repository path |
name | string | No | Tag name (omit to list) |
message | string | No | Tag message (creates annotated tag) |
remote
List remote repositories
Module: git | Returns: object -- API response.
git.remote
| Parameter | Type | Required | Description |
|---|---|---|---|
cwd | string | No | Repository path |
verbose | boolean | No | Show URLs (default: true) |
merge
Merge a branch into the current branch
Module: git | Returns: object -- API response.
git.merge
| Parameter | Type | Required | Description |
|---|---|---|---|
branch | string | Yes | Branch to merge |
cwd | string | No | Repository path |
noFf | boolean | No | Create a merge commit even for fast-forward |
stash
Stash or restore uncommitted changes
Module: git | Returns: object -- API response.
git.stash
| Parameter | Type | Required | Description |
|---|---|---|---|
cwd | string | No | Repository path |
action | string | No | Action: push, pop, list, drop, apply (default: push) |
message | string | No | Stash message (for push) |
reset
Reset the current HEAD to a specified state
Module: git | Returns: object -- API response.
git.reset
| Parameter | Type | Required | Description |
|---|---|---|---|
cwd | string | No | Repository path |
ref | string | No | Commit reference (default: HEAD) |
mode | string | No | Reset mode: soft, mixed, hard (default: mixed) |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
| (standard errors) | Check function parameters and authentication |
@desc "Clone and validate result"
do
set $result as git.clone
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. Create a new item with add
Create a new resource and capture the result.
set $result as git.add
print "Created: " + $result
2. Multi-step Git workflow
Chain multiple git operations together.
@desc "Clone, init, and more"
do
set $r_clone as git.clone
set $r_init as git.init
set $r_status as git.status
print "All operations complete"
enddo
3. Safe clone with validation
Check results before proceeding.
@desc "Clone and validate result"
do
set $result as git.clone
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- docker -- Docker module for complementary functionality
- github -- GitHub module for complementary functionality
- gitlab -- GitLab module for complementary functionality
- vercel -- Vercel module for complementary functionality
- netlify -- Netlify module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.1 | latest | 1 months ago |
Related Modules
github
JS@robinpathv0.1.1
GitHub module for RobinPath.
bitbucket
JS@robinpathv0.1.2
Bitbucket module for RobinPath.
box
JS@robinpathv0.1.2
Box module for RobinPath.
cache
JS@robinpathv0.1.2
In-memory key-value cache with optional TTL expiration for temporary data storage
$ robinpath add @robinpath/git
