Local Repo#

class oxen.LocalRepo(path: str = '')#

Local repository object that allows you to interact with your local oxen repo.

add(path: str)#

Stage a file or directory to be committed.

checkout(revision: str, create=False)#

Checkout a branch or commit id.

Parameters:
  • 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

clone(url: str, branch: str = 'main', shallow=False, all=False)#

Clone repository from a remote url.

Parameters:
  • url (str) – The url of the remote repository. ex) https://hub.oxen.ai/ox/chatbot

  • branch (str) – The name of the branch to clone. Default: main

  • shallow (bool) – Whether to do a shallow clone or not. Default: False

  • all (bool) – Whether to clone the full commit history or not. Default: False

commit(message: str)#

Commit the staged data in a repo with a message.

Parameters:

message (str) – The commit message.

property current_branch#

Returns the current branch.

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.

log()#

Get the commit history for a repo.

property path#

Returns the path to the repo.

pull(remote_name: str = 'origin', branch: str = 'main')#

Pull data from a remote repo to a local repo.

Parameters:
  • remote_name (str) – The name of the remote to pull from.

  • branch (str) – The name of the branch to pull from.

push(remote_name: str = 'origin', branch: str = 'main')#

Push data to a remote repo from a local repo.

Parameters:
  • remote_name (str) – The name of the remote to push to.

  • branch (str) – The name of the branch to push to.

set_remote(name: str, url: str)#

Map a name to a remote url.

Parameters:
status()#

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