> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oxen.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Repo

<a id="oxen.repo" />

# oxen.repo

<a id="oxen.repo.Repo" />

## Repo Objects

```python theme={null}
class Repo()
```

The Repo class that allows you to interact with your local oxen repo.

## Examples

### Init, Add, Commit and Push

Adding and committing a file to a remote workspace.

```python theme={null}
import os
from oxen import Repo

# Initialize the Oxen Repository in a CatsAndDogs directory
directory = "CatsAndDogs"
repo = Repo(directory)
repo.init()
repo.add("images")
repo.commit("Adding all the images")
# Replace <namespace> and <repo_name> with your values
repo.set_remote("origin", "https://hub.oxen.ai/<namespace>/<repo_name>")
repo.push()
```

<a id="oxen.repo.Repo.__init__" />

## \_\_init\_\_

```python theme={null}
def __init__(path: str = "", mkdir=False)
```

Create a new Repo object. Use .init() to initialize a new oxen repository,
or pass the path to an existing one.

**Arguments**:

* `path` - `str`
  Path to the main working directory of your oxen repo.
* `mkdir` - `bool`
  Whether to create the directory if one doesn't exist. Default: False

<a id="oxen.repo.Repo.init" />

## init

```python theme={null}
def init()
```

Initializes a new oxen repository at the path specified in the constructor.
Will create a .oxen folder to store all the versions and metadata.

<a id="oxen.repo.Repo.clone" />

## clone

```python theme={null}
def clone(url: str, branch: str = "main", all=False)
```

Clone repository from a remote url.

**Arguments**:

* `url` - `str`
  The url of the remote repository. ex) [https://hub.oxen.ai/ox/chatbot](https://hub.oxen.ai/ox/chatbot)
* `branch` - `str`
  The name of the branch to clone. Default: main
* `all` - `bool`
  Whether to clone the full commit history or not. Default: False

<a id="oxen.repo.Repo.branches" />

## branches

```python theme={null}
def branches()
```

List all branches for a repo

<a id="oxen.repo.Repo.branch" />

## branch

```python theme={null}
def branch(name: str, delete=False)
```

<a id="oxen.repo.Repo.checkout" />

## checkout

```python theme={null}
def checkout(revision: str, create=False)
```

Checkout a branch or commit id.

**Arguments**:

* `revision` - `str`
  The name of the branch or commit id to checkout.
* `create` - `bool`
  Whether to create a new branch if it doesn't exist. Default: False

<a id="oxen.repo.Repo.add" />

## add

```python theme={null}
def add(path: str)
```

Stage a file or directory to be committed.

<a id="oxen.repo.Repo.add_schema_metadata" />

## add\_schema\_metadata

```python theme={null}
def add_schema_metadata(path: str, column_name: str, metadata: str)
```

Add schema to the local repository

<a id="oxen.repo.Repo.rm" />

## rm

```python theme={null}
def rm(path: str, recursive=False, staged=False)
```

Remove a file or directory from being tracked.
This will not delete the file or directory.

**Arguments**:

* `path` - `str`
  The path to the file or directory to remove.
* `recursive` - `bool`
  Whether to remove the file or directory recursively. Default: False
* `staged` - `bool`
  Whether to remove the file or directory from the staging area.
* `Default` - False
* `remote` - `bool`
  Whether to remove the file or directory from a remote workspace.
* `Default` - False

<a id="oxen.repo.Repo.status" />

## status

```python theme={null}
def status()
```

Check the status of the repo. Returns a StagedData object.

<a id="oxen.repo.Repo.commit" />

## commit

```python theme={null}
def commit(message: str)
```

Commit the staged data in a repo with a message.

**Arguments**:

* `message` - `str`
  The commit message.

<a id="oxen.repo.Repo.log" />

## log

```python theme={null}
def log()
```

Get the commit history for a repo.

<a id="oxen.repo.Repo.set_remote" />

## set\_remote

```python theme={null}
def set_remote(name: str, url: str)
```

Map a name to a remote url.

**Arguments**:

* `name` - `str`
  The name of the remote. Ex) origin
* `url` - `str`
  The url you want to map the name to. Ex) [https://hub.oxen.ai/ox/chatbot](https://hub.oxen.ai/ox/chatbot)

<a id="oxen.repo.Repo.push" />

## push

```python theme={null}
def push(remote_name: str = "origin",
         branch: str = "main",
         delete: bool = False)
```

Push data to a remote repo from a local repo.

**Arguments**:

* `remote_name` - `str`
  The name of the remote to push to.
* `branch` - `str`
  The name of the branch to push to.

<a id="oxen.repo.Repo.pull" />

## pull

```python theme={null}
def pull(remote_name: str = "origin", branch: str = "main", all=False)
```

Pull data from a remote repo to a local repo.

**Arguments**:

* `remote_name` - `str`
  The name of the remote to pull from.
* `branch` - `str`
  The name of the branch to pull from.
* `all` - `bool`
  Whether to pull all data from branch history or not. Default: False

<a id="oxen.repo.Repo.path" />

## path

```python theme={null}
@property
def path()
```

Returns the path to the repo.

<a id="oxen.repo.Repo.current_branch" />

## current\_branch

```python theme={null}
@property
def current_branch()
```

Returns the current branch.

<a id="oxen.repo.Repo.merge" />

## merge

```python theme={null}
def merge(branch: str)
```

Merge a branch into the current branch.
