Create a repository
You can initialize an Oxen repository locally withoxen init
.oxen folder in your working directory, which contains the metadata for the repository. It’s also where each commit’s Merkle Tree will be stored new files are added and committed.
Add files
Add files to a repository withoxen add. This copies the files’ contents to the repository’s version store and stages the changes to the staged_db.
You can add files and directories (added recursively) using either absolute paths or their relative paths to the repo root.
.oxenignore
oxen status
oxen commands. Under the hood, oxen stores different File Metadata for different types for additional functionality
Commit Changes
To commit the changes that are staged with a message you can usemain branch
Once you’ve committed a file, a copy of its contents will be stored in the repository’s version store. By default, the version files will be located in .oxen/versions/files. File and directory metadata are stored in the Merkle Tree, which mimics the structure of the working directory
View History
You can see the history of changes on your current branch by running:List Branches
To view the branch you’re on, useoxen branch. This will list all of the repo’s branches, highlighting the current one.
oxen branch --remote
oxen branch --delete. This will fail if the branch is not safe to delete (i.e., it has changes that aren’t merged to main)
View Status
To see what data is tracked, staged, modified, removed, or not yet added to the repository you can useoxen status
Note: since we are dealing with large datasets with many files, status rolls up the changes and summarizes them for you.
-s (skip) and -l (limit) params on the status command. Run oxen status --help for more info.
Restore Files
If you want to revert changes you’ve made to a file in the working directory, you can useoxen restore to restore the file to its version in the HEAD commit. This works with deleted or modified files
oxen restore on directories to recursively restore their files
If you want to restore to a specific version in your commit history, you can supply the commit id or branch name with the --source flag.
staged_db using oxen restore --staged
Removing Data
To stage a file to be removed from the next commit, use theoxen rm command.
-r flag.
staged_db using oxen rm --staged
Checkout Revision
You can create a new branch withoxen checkout --branch
oxen checkout to safely move between them. This will restore the working directory to head commit of the branch you’re checking out
View Diffs
Oxen can compute and display the diff between files using the oxen diff commanddataset.csv in the working directory with its version in the HEAD commit. You can also compare different files, compare files across revisions, and compare different revisions with each other
Merge Commits
You can create a merge commit withoxen merge. This will merge the current branch into the target, or fail if there are merge conflicts
